|
I think theres a bit of disappointment that they're pushing this instead of pushing something new that fixes all the issues developers face every day. It's easier to post zingers about how this is smoke and mirrors to distract us for a while than it is to look at kotlin and be like "hmm maybe i'll use this one day when Im doing something that isnt critical"
|
# ? May 18, 2017 19:11 |
|
|
# ? May 14, 2024 08:34 |
|
Ok guys I've been trying to figure this one out all day. I have a package name that I am trying to launch but I have neither the source code nor the main activity name to be able to launch it without simulating the click on screen using UiAutomator. Anyone have any ideas on how I would go about doing this? I saw someone on Stack Overflow say something about PackageManager but I couldnt parse what it was trying to say due to being in Hinglish.
|
# ? May 30, 2017 22:53 |
|
funny Star Wars parody posted:I think theres a bit of disappointment that they're pushing this instead of pushing something new that fixes all the issues developers face every day. I think it's worth it just for the "import kotlinx.android.synthetic.main.activity_foo.* " thing that handles all of the "private TextView mTextFoo;" and "mTextFoo = (TextView) findViewById(R.id.textFoo);" boilerplate with just one import line for the entire layout.
|
# ? May 30, 2017 23:45 |
|
Mezzanine posted:I think it's worth it just for the "import kotlinx.android.synthetic.main.activity_foo.* " thing that handles all of the "private TextView mTextFoo;" and "mTextFoo = (TextView) findViewById(R.id.textFoo);" boilerplate with just one import line for the entire layout. if you want to win people over, maybe don't mention the fact that you're a fan of wildcard imports
|
# ? May 31, 2017 00:37 |
|
Lutha Mahtin posted:if you want to win people over, maybe don't mention the fact that you're a fan of wildcard imports So, import every single id in the layout I just wrote myself by hand? Mezzanine fucked around with this message at 01:24 on May 31, 2017 |
# ? May 31, 2017 01:22 |
|
Lutha Mahtin posted:if you want to win people over, maybe don't mention the fact that you're a fan of wildcard imports What's wrong with a wildcard import on something with your own package name that you wrote yourself?
|
# ? May 31, 2017 02:17 |
|
i honestly don't know how to respond to either of those posts. one of them implies that the poster only uses 1970s text editors without any kind of IDE functionality. the other implies the poster doesn't understand the basics of predicate logic. both of them defend wildcard imports. i'm really out of my depth in a situation where people are that ignorant and yet are insistent that their ignorance is correct and valid
|
# ? May 31, 2017 02:39 |
|
Lutha Mahtin posted:i honestly don't know how to respond to either of those posts. one of them implies that the poster only uses 1970s text editors without any kind of IDE functionality. the other implies the poster doesn't understand the basics of predicate logic. both of them defend wildcard imports. i'm really out of my depth in a situation where people are that ignorant and yet are insistent that their ignorance is correct and valid Thank you for your insightful response and detailed explanation of your initial comment! I'll make sure to put all of your thoughtful advice to good use! After all, that's what this thread is here for, right?
|
# ? May 31, 2017 02:54 |
|
funny Star Wars parody posted:Ok guys I've been trying to figure this one out all day. I have a package name that I am trying to launch but I have neither the source code nor the main activity name to be able to launch it without simulating the click on screen using UiAutomator. Anyone have any ideas on how I would go about doing this? I saw someone on Stack Overflow say something about PackageManager but I couldnt parse what it was trying to say due to being in Hinglish. adb logcat ActivityManager:V *:F Launch the app, you'll see what the package name and the path to the main activity are. Otherwise, you can use aapt to dump the manifest contents to find the activity with the internet filter with MAIN in it. Edit: with regard to IDs, your IDE will generally let you do static imports, which provides cleaner layout without accidental collisions/pollutions from other namespaces.
|
# ? May 31, 2017 02:57 |
|
Lutha Mahtin posted:i honestly don't know how to respond to either of those posts. one of them implies that the poster only uses 1970s text editors without any kind of IDE functionality. the other implies the poster doesn't understand the basics of predicate logic. both of them defend wildcard imports. i'm really out of my depth in a situation where people are that ignorant and yet are insistent that their ignorance is correct and valid Honestly dude you are acting like a douche.
|
# ? May 31, 2017 03:20 |
|
Volmarias posted:Edit: with regard to IDs, your IDE will generally let you do static imports, which provides cleaner layout without accidental collisions/pollutions from other namespaces. Yeah, I do that in most cases (Android Studio / IntelliJ handles imports automatically quite well). This is a rather specific case where the "Kotlin addons plugin" provides all of the ids in a specific layout xml as an import. In many cases, an Activity / Fragment will only be using one layout so the wildcard would be fine. The other option is to have the IDE import them piecemeal as I reference them in code, which is what I do for anything not handwritten by myself.
|
# ? May 31, 2017 03:31 |
|
Lutha Mahtin posted:one of them implies that the poster only uses 1970s text editors without any kind of IDE functionality "my editor generates the meaningless boilerplate" is not a very compelling argument
|
# ? May 31, 2017 07:40 |
|
Volmarias posted:adb logcat ActivityManager:V *:F Nice, thanks! I found this way of launching the package however I'm not sure why he's able to call the getPackageManager() and startActivity methods. I'm assuming it comes from a Context that is written somewhere else but I haven't written test code for a package I dont have the source code for before Java code:
|
# ? May 31, 2017 15:06 |
|
funny Star Wars parody posted:Nice, thanks! I found this way of launching the package however I'm not sure why he's able to call the getPackageManager() and startActivity methods. I'm assuming it comes from a Context that is written somewhere else but I haven't written test code for a package I dont have the source code for before I assume that whatever class this is in extends context, or just also happened to have convenience methods for startActivity and getPackageManager. Without more info about where this code snippet lives I can't give you something better
|
# ? Jun 1, 2017 03:36 |
|
funny Star Wars parody posted:Nice, thanks! I found this way of launching the package however I'm not sure why he's able to call the getPackageManager() and startActivity methods. I'm assuming it comes from a Context that is written somewhere else but I haven't written test code for a package I dont have the source code for before This is in an instrumentation test? Can you use InstrumentationRegistry.getTargetContext() for it?
|
# ? Jun 1, 2017 12:09 |
|
baka kaba posted:This is in an instrumentation test? Can you use InstrumentationRegistry.getTargetContext() for it? This worked, at least for the other apps on this device! There is an app that will only launch when you hold three physical buttons for three seconds and even though I have the package name it simply won't launch, and UiAutomator can grab the XML for me to simulate click events once the app is launched. I'm starting to wonder if the app was written weird for it to do this For the record this is a automobile head unit/nav unit that I'm working on automating testing for so that's why this has been such a bitch compared to abnormal phone/tablet
|
# ? Jun 1, 2017 23:16 |
|
funny Star Wars parody posted:This worked, at least for the other apps on this device! There is an app that will only launch when you hold three physical buttons for three seconds and even though I have the package name it simply won't launch, and UiAutomator can grab the XML for me to simulate click events once the app is launched. I'm starting to wonder if the app was written weird for it to do this You can always launch an activity via an explicit intent, as long as you know what the activity name is, and as long as the activity is marked as exported. I'm curious how they're doing the key press thing though, is possible that this head unit remapped that to the camera key or something.
|
# ? Jun 1, 2017 23:40 |
|
Does it not launch at all, or does it start and immediately quit? They might have some weird Intent handler code that nopes out if you didn't launch it with the correct data Unless, is the head unit already running that app as the UI? So it's capturing the keypresses and launching another 'app' that's really an internal component of the same app? Meaning the activity you're trying to launch might not actually be exported
|
# ? Jun 2, 2017 00:29 |
|
baka kaba posted:Does it not launch at all, or does it start and immediately quit? They might have some weird Intent handler code that nopes out if you didn't launch it with the correct data It doesnt start at all and I get a "cannot call an intent from a null something something" error so I'm guessing the Intent is not exported Volmarias posted:You can always launch an activity via an explicit intent, as long as you know what the activity name is, and as long as the activity is marked as exported. You press the Volume button + brightness button + home button for three seconds, I have no idea what they're overriding but it's pretty neato bandito (except for the part where i have to mark it as a semi-automated test instead of a fully automated test )
|
# ? Jun 2, 2017 01:27 |
|
funny Star Wars parody posted:It doesnt start at all and I get a "cannot call an intent from a null something something" error so I'm guessing the Intent is not exported Redact the package name but post the error log here. What process gives that, the process you're trying to call, or the system_service? Again, use logcat to parse ActivityManager logs to see what the entry Activity is. You can use an Explicit intent to start that activity, although how exactly you'll be testing is an open question.
|
# ? Jun 2, 2017 01:39 |
|
Has anyone goofed with the architecture framework they rolled out at I/O and have opinions on it yet?
|
# ? Jun 2, 2017 04:10 |
|
Volmarias posted:Redact the package name but post the error log here. What process gives that, the process you're trying to call, or the system_service? code:
Java code:
|
# ? Jun 2, 2017 14:38 |
|
Well you're getting it from thisquote:The current implementation looks first for a main activity in the category CATEGORY_INFO, and next for a main activity in the category CATEGORY_LAUNCHER. Returns null if neither are found. This sounds like a pain in the to be honest!
|
# ? Jun 2, 2017 16:36 |
|
baka kaba posted:Well you're getting it from this Nah it just means instead of trying to launch it via an activity i will have to use a CAN database to simulate the signal that pressing the button does. The same thing happens when I try to launch the HVAC settings via activity instead of hitting the hard button, which tells me that it only wants a CAN/MOST signal instead of pure android implementation
|
# ? Jun 2, 2017 16:43 |
|
Again, look for the exported activity that gets launched when you press those buttons and specify it manually. Use setClassName to specify what you want to launch. You don't need to pick the one that would show up in the launcher, since you already told us it won't. If the package doesn't export any activities (due to catching a signal via broadcast intent or some other fuckery) then realistically you truly are hosed, but please start by finding the activity that you're trying to test. Volmarias fucked around with this message at 02:59 on Jun 3, 2017 |
# ? Jun 3, 2017 02:57 |
|
Volmarias posted:
I tried every package name that the logcat spat out and none of them worked Are package names supposed to have slashes like com.bench.tuner/AMTuner or do I have to do some kind of string handling to handle the / character
|
# ? Jun 3, 2017 02:59 |
|
funny Star Wars parody posted:I tried every package name that the logcat spat out and none of them worked The slash delineates the package name from the activity. Rather than repeating the entire package name, it strips the part that's already been provided. So, com.foo.bar with an activity at com.foo.bar.main.Butts would be represented as com.foo.bar/.main.Butts (I think it's .main and not main, but confirm this yourself) Alternately, if you can get the apk itself, use aapt dump to dump out the (data representation of the) AndroidManifest file Alternately, ADB dumpsys package will give you more than you ever wanted to know, but your info might show up there. Volmarias fucked around with this message at 05:02 on Jun 3, 2017 |
# ? Jun 3, 2017 04:59 |
|
Volmarias posted:The slash delineates the package name from the activity. Rather than repeating the entire package name, it strips the part that's already been provided. So, com.foo.bar with an activity at com.foo.bar.main.Butts would be represented as com.foo.bar/.main.Butts (I think it's .main and not main, but confirm this yourself) I'll have to check it out on monday and see if I can figure anything else out. I wont be able to get any source code from the client and with how modified the OS appears to be I'm guessing that i'm in some uncharted waters and will have to do it the hard way
|
# ? Jun 3, 2017 05:06 |
|
Ok here's the adb logcat ActivityManager:V *:F log dump when I launch the hidden app using button presses.code:
code:
|
# ? Jun 5, 2017 16:19 |
|
I saw you're using getContext() - did you try getTargetContext() instead? I'm not sure exactly how it will work for what you're doing, but the target context is for the thing under instrumentation, instead of the thing running the tests
|
# ? Jun 5, 2017 16:36 |
|
baka kaba posted:I saw you're using getContext() - did you try getTargetContext() instead? I'm not sure exactly how it will work for what you're doing, but the target context is for the thing under instrumentation, instead of the thing running the tests Hmm, that seems to be giving me the same java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.Intent android.content.Intent.addFlags(int)' on a null object reference. Google hasnt exactly been very helpful in looking for clues on this one either so i'm not 100% sure.
|
# ? Jun 5, 2017 19:00 |
|
Do this to start the diagnostics app:code:
funny Star Wars parody posted:Hmm, that seems to be giving me the same java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.Intent android.content.Intent.addFlags(int)' on a null object reference. Google hasnt exactly been very helpful in looking for clues on this one either so i'm not 100% sure. The error is exactly what it says. You can't call the "addFlags" instance method on a null instance. Your intent doesn't exist, that's the problem. There IS NO LAUNCH ACTIVITY (as far launchers are concerned) for this app. If you haven't yet learned how to, I highly recommend learning how to use the debugger. Edit: to further clarify, here's the source for getLaunchIntentForPackage, which you should not be using here because there is no launch activity: code:
Now, mind you, it's possible that there are some extras in the intent that need to be provided, so unless you have root on the test device and can pull the target app to examine it, or flash a debug build which shows all of the intent info, you might still be SOL. That said, why haven't you contacted the OEM for info yet? Volmarias fucked around with this message at 19:05 on Jun 6, 2017 |
# ? Jun 6, 2017 18:55 |
|
Volmarias posted:Do this to start the diagnostics app: That being said, the only fix I had to add was intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) after the clear task flag method call to get this to work . I wish I had caught on to your hints sooner, I didnt realize that you could specify intent class names using the .setClassName() method and google is wicked sparse on the details for doing anything with AndroidJUnit/UiAutomator for some reason (i'm assuming because most places have smarter people than me to figure it out ) Thanks for this!
|
# ? Jun 6, 2017 19:19 |
|
funny Star Wars parody posted:I didnt realize that you could specify intent class names using the .setClassName() meth quote:Thanks for this! You're welcome
|
# ? Jun 6, 2017 20:06 |
|
Volmarias posted:I straight up told you to do this oh you did and i forgot to click the link i'm literally retarded
|
# ? Jun 6, 2017 20:10 |
|
This might be the entirely wrong place, but is anyone here familiar with how to get in touch with any sort of Google Play Store category managers? Apple has a developer relations team and I was wondering if Google had something similar.
|
# ? Jun 21, 2017 21:07 |
|
Doh004 posted:This might be the entirely wrong place, but is anyone here familiar with how to get in touch with any sort of Google Play Store category managers? Apple has a developer relations team and I was wondering if Google had something similar. They categorically do not. They're famous for how much of a black box their store is, and getting in contact with someone to resolve issues is near-impossible.
|
# ? Jun 21, 2017 21:28 |
|
Doh004 posted:This might be the entirely wrong place, but is anyone here familiar with how to get in touch with any sort of Google Play Store category managers? Apple has a developer relations team and I was wondering if Google had something similar. Best I've done is post on Google+ and include prominent DevRel folks like Ian Lake in my post asking for help. This got me out or a jam once.
|
# ? Jun 21, 2017 22:13 |
|
Contacting google customer support consists of getting a post on medium about your problem onto the front page of HN.
|
# ? Jun 21, 2017 23:18 |
|
|
# ? May 14, 2024 08:34 |
|
Gotcha, that's more related to app support which is good to know - I'm actually asking about the business development people? Who manages the Play Store categories? How do you get featured more prominently? Set up partnerships between the two etc.
|
# ? Jun 22, 2017 16:21 |