While debugging my app using Monkey (which is almost as fun as the real thing), I managed to crash! Yay, that's what it's for, right?
Looking at the log (and while watching) I noticed that Monkey is occasionally doing:
:Sending Flip keyboardOpen=true
which seems to be part of my problem. When this happens, the screen in the emulator rotates 90 degrees, but this is NOT the same as a regular rotation you get by hitting KEYPAD_7. Here's a picture:
It looks to me the emulator is emulating a keyboard opening (flip), which is subtly different from a rotation.
So the question is: How do I emulate that myself? Sure, running Monkey is neat, but waiting for it to randomly choose to send a keyboardOpen message is no way to debug a program.
Maybe use the --pct-majornav to restrict the monkey to just the 'major' nav events (I'm assuming keyboard changes are 'major', I'm not sure though).
You could also look into writing a specific test based on the different but similar monkeyrunner framework: http://developer.android.com/guide/developing/tools/monkeyrunner_concepts.html ... but I don't see any way to inject keyboard flip codes.
I found this relevant SO question:
Simulating opening/closing the hardware keyboard in emulator but the "answer" there is confusing and seems insufficient.
Not really your question, but related to your root issue:
Did you forget to include 'keyboardHidden' in the 'android:configChanges' section of the manifest file? (Or did you include it, but you don't handle the config change callbacks?)
The keyboard hide/reveal will restart your activity. You can either declare that you handle that restart, or if you don't, the OS will stop and restart the app itself.
See http://developer.android.com/guide/topics/resources/runtime-changes.html
Update
I believe this is the source for the monkey application's keyboard flip event. It looks like injecting a keyboard flip event would be relatively straight-forward: Open /dev/input/input0 and write 16 magical bytes into it.
Also, the source seems to have an undocumented --pct-flip option for controlling keyboard flip rates: link
Related
developer.chrome.com/apps/getstarted_arc#bestpractices
The ARC allows you to execute native android apps through the chrome browser by wrapping a chrome app around it.(As far as I can tell)
I am re-factoring an Android app to work well on Chrome. The first thing I need to do is to make the back arrow enabled at all times on the top left as shown below.
This is the program that allows Native android apps to run through chrome. I think the answer to my question lies somewhere in "Additional Metadata", or in the source code?
Add {"disableAutoBackButton": "true"} to the metadata. That will enable the back button within an activity. I've found that with my app that has multiple activities, though, it doesn't work to return to my main activity from my settings activity. It could be that I'm doing something wrong with the way I'm handling activities, I guess, but it works on all physical devices.
{"sleepOnBlur":false,"disableAutoBackButton":true}
please supply the above metadata before you download the zip or launch app from the arc welder
the first param prevents excessive pause/resume and also supposed to fix short black screen flash occurring occassionally in some of the apps.
the second params adds persistance back button on top left hence helping to avoid extra code required because of absence of back button in some screens(mostly the first screen)
Is it possible like in topic, I mean start camera intent and before opening that view set screen not to see rotating screen effectc? I was trying to use overridePendingTransition after startingActivityForResult, I tried also to put this overriDePendingTransition while calling onPause and OnResume. Somehow camera uses own animation. I would like to disable that animation. Is is possible? This effect doesn't affect in android 2.3.x. Does it might have connection with touchWiz?
TL:DR
As of KitKat 4.4.2 this still does not seem possible. Tested with AOSP phone app, Nexus 5 experience Phone App, Maps, AOSP Browser and Chrome.
(I would have put this in a comment, not enough rep yet. It's still an answer per-say, though not a solution to the problem)
Only thing I can say about why it's not possible is:
If you could force a transaction on the "external" intent through
your own app code, you would be basically injecting your animation
into another publisher's app, which would be a MAJOR design flaw
in the Android framework.
My guess is this will never be possible unless the OS manages such transactions in a bullet-proof way to both ends. Some AOSP branded-builds and custom Launchers can change default animations for ALL activity starts/resumes though (or even use no animations at all).
I've been using FLAG_WATCH_OUTSIDE_TOUCH to get touches from a system overlay in honeycomb, but this no longer works in ICS. I need the application underneath to receive touches too so TYPE_SYSTEM_ALERT didnt work. The application isnt going to be put on the play store so its ok if it needs root or to be put in the system directory to work. Any ideas?
Thanks,
ng93
It seems this is just the case, as this post highlights. This is generally a bad idea, see the documentation:
These windows must not take input focus, or they will interfere with the keyguard.
I haven't actually tested those overlays on Android 4.0 ICS but other apps like SwipePad seem to do this just fine. The only concern I am aware of is related to performance, such overlays often take a hefty toll on the device. If you want to accurately detect touch input and the overlay does not have to be above the lock screen, try TYPE_SYSTEM_ALERT. Another post on SO seems to have chosen that type as well.
I'm quite new to Android programming but familiar with C/C++ and Linux enough to program a few stuff. In my next project, I've to run some native application (Linux applications) under Android.
The executable I'm calling is using the framebuffer device to produce screen output. When I try to just call the program the output of the program is lost because Android is redrawing the screen, thus overwriting the framebuffer.
In order to prevent this, I made a "stubbing" Android program, which actually has no window design (just a black screen) but calls my program. This is working good to some extend; however, whenever I rotate the screen, or some Tattoo notification comes, Android redraws the screen and we're back to frame #1...
Thus, I wondered if there is a "low level" API or something, which can prevent Android from using the screen at all, as long as I release it. Shortly, like a WakeLock preventing phone from sleeping, I want a 'Lock' which will lock the screen (framebuffer device) completely. Does anyone know how can I achieve such functionality?
PS: This might have something to do with SurfaceFlinger, but I've read somewhere that it doesn't publish any API to user-level.
On Android the screen belongs to SurfaceFlinger.
The executable I'm calling is using the framebuffer device to produce screen output.
That's not supported.
Thus, I wondered if there is a "low level" API or something, which can prevent Android from using the screen at all, as long as I release it.
Nothing that is supported at the SDK or NDK levels. You are welcome to create your own custom firmware that does whatever you want, and load that custom firmware on your own device.
Otherwise, please use a supported means for interacting with the screen (e.g., OpenGL natively in C/C++).
I looked around and although there are many related questions I didn't see one that answers my exact question:
I would like to create an app that runs in the background that provides the exact same functionality as the hard coded 'Back' button in all cases.
The reason? I (for example) have a Droid X, and it is BIG. it makes it extremely hard to use one-handed and having a swipe gesture function as a back button (like in Palm Pre for example) would greatly increase the ease of use.
as far as I'm concerned the app could just be one simple class that contains:
1) a listener for the 'back' swipe
2) a call to the physical hard button itself
Is this possible? are there built in APIs for the hard coded buttons that would allow me to call them without actually pressing them?
Again - I'm not interested in overriding the button, I'm interested in making a software call to it - or failing that, in emulating it's behavior in any and all states and other apps!
Please forgive the naivete of this post. I am a very novice programmer and really I just want to know whether this is possible before I start to devote myself to trying to build it.
Thank you,
b
Is this possible?
By writing your own firmware, yes. Via an Android SDK application, no.