Android uiautomator - working with with bars - android

While trying Android uiautomator utility i face some problem working with bars. (such as bottom bar that display time, wifi status, battery etc...)
The issue is that the bottom bar seems to be not part of the display and when trying to click on it (using uidevice method click(x,y) ), i am getting return value of false - , clicking on pixel above it works just fine (with return value of true)
when using the uiviewer utility clicking on the bar does not update the right pane, e.g: the "display" does not seem to include the bar at all.
is there a known issue with bars and uiautomator ?
can bar be test/interact using uiautomator ?
Thanks in advance, Gal.

My initial investigations match your findings - neither the top notification bar (that displays the time, status indicators e.g. battery, network connectivity, etc) or the bottom bar with icons for the soft keys (back, home, etc.) are available in uiautomationviewer despite being contained in a FrameLayout.
(Note: I'm checking on a Nexus 4 phone, and a Nexus 7 tablet. Some tablet devices have the notification bar at the bottom of the screen e.g. my A500)
Based on my preliminary findings UI Automator will not be suitable. Perhaps monkeyrunner would be more suitable e.g. see the following question and answer Can monkeyrunner interact with android notifications?

When i tried to use the monkeyrunner touch method with a coordinate locate inside the bar it work fine.
I guess this is something that Google will fix in future releases in the UiAutomator.
Thanks again,
Gal.

Related

Android disable notification bar [root]

I need to enable this on 4.2.2 android tablet.
I've successfull'y done that using this terminal command:
"settings put global device_provisioned 1"
The problem is, that this command also disables HOME button, so I cannot use it. Seems like system stops sending intents.
I've found ways to disable whole system bar at the top and bottom of the screen, but then I loose my navigation buttons.
I've tried disabling notifications one by one, but I still see searching for GPS and Android active hotspot icons in notification bar.
It seems I've tried everything I could, but am unable to get required functionality.
What else could I try?

Getting rid of Status Bar on 4.1

I need to get rid of the system bar on Android 4.1 tablets since the tablets will be in a commercial/retail environment and be used for business. My app will be the only app used on the tablet and it needs as much screen real estate as possible for what we're trying to do. I have searched already and I see that there are ways to do it on a rooted tablet, however since this will be in a business and deployed to several hundred or thousand businesses, I cannot have all the tablets rooted for legal and security issues. (Would I really have issues legally though if I were to root them?)
I know that you can dim the status bar and make the buttons dots but that really isn't optimal.
If there is no way to get rid of it, is it possible to change the status bar icons and functionality? I ask this because our app has a status bar on top and we could possibly move it to the bottom and change the icons and functionality of the status bar to match the app's status bar so no screen real estate is lost.
I have read that 4.2 adds some fullscreen functionality for apps. Is this true? Can the status bar be hidden in 4.2 as opposed to 4.1?
I need to get rid of the system bar on Android 4.1 tablets
That is not possible, except via rooted devices and/or ROM mods. Moreover, the user needs this bar to be there, otherwise they have no access to the HOME and BACK buttons.
Would I really have issues legally though if I were to root them?
StackOverflow is not a law office. Please consult with qualified legal counsel regarding such concerns.
is it possible to change the status bar icons and functionality?
That is not possible, except via rooted devices and/or ROM mods.
I have read that 4.2 adds some fullscreen functionality for apps. Is this true?
Not exactly. The bottom navigation bar (HOME, BACK, RECENTS) can be hidden, but they will return as soon as the user touches the screen. The top status bar (signal strength, battery level, etc.) can be removed via a Fullscreen theme.

android How to set Hidden this bar (in tablet Android 4.0.3)

I'm trying to make my app to Fullscreen (with no any bar) how I can coding to set it. (Android version 4.0.3)
Thx very Much
You can't hide that bar. On Honeycomb(3.0) there was a bug that would allow it to be hidden(on a rooted device), but it was fixed in ICS(4.0). (Note: see this answer for more techniques that worked on 3.0)As of now there is no way to do it on 4.0. Unfortunately, because devices no longer have physical buttons the navigation buttons (home and back) have to be put onto the screen. Because that bar contains the navigation buttons if you were to hide it, it would be possible to "lock" the user out of the device by not allowing them to leave your application(at least until they rebooted into safe mode).
So if you want to do that you'll have to make your own custom version of the OS to allow for it.

Easy way to hide system bar on Android ICS

I will give my ICS tablets for users to complete a survey so I would like the user to work with my app only. They should not be able to switch to the home screen, press back buttons etc., so I would like to hide the system bar completely.
My tablet is rooted and I know some application like
this can help me, but I don't need all the extra functions of this app.
I found this tutorial that could help me, but if I can add the code to do my own, it would be great.
After a lot of searching on the internet, I managed to get the System Bar to hide and appear in a 4.2 device using:
To Hide:
Runtime.getRuntime().exec("service call activity 42 s16 com.android.systemui");
Or use 79 instead of 42 for API less than 14. You may also need to include the SET_DEBUG_APP permission, in which case you need to have the application signed with the system key or installed in the /system/app/ directory.
To Show:
Runtime.getRuntime().exec("am startservice --user 0 -n com.android.systemui/.SystemUIService");
Alternatively some people have used the -a (instead of -n) option, though this was causing an error on my device:
Error: Not found; no service started.
For Android 4.4, there is a new feature called immersive mode which hides both the system and status bars. The system UI is toggled by the user through the use of an edge swipe from the top or bottom of the screen. For more details take a look at:
http://developer.android.com/reference/android/view/View.html#setSystemUiVisibility(int)
Using new IMMERSIVE mode in android kitkat
For example:
getWindow().getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE)
HideBar has a kiosk mode especially for this use case.
A free download is available at http://ppareit.github.com/HideBar/.
You can also find it in the market at https://play.google.com/store/apps/details?id=be.ppareit.hidebar.
If you want to incorporate it in your own test/survey application you can always contact the developer (see the links for an email). The code could be explained or an Intent to do the hiding could be provided.
check this link: (requires root)
http://android.serverbox.ch/?p=306
similar question was posted here also:
Is there a way to hide the system bar in Android 3.0? It's an internal device and I'm managing navigation
or try HideBar
http://ppareit.github.com/HideBar/
Actually you can simply put the system bar in "lights out" mode, the system bar buttons and notifications gets dimmed.
View v = findViewById(R.id.view_id);
v.setSystemUiVisibility(View.STATUS_BAR_HIDDEN);
I want to add some information to the existing replies hoping it will be useful for someone.
To get a real full screen working on my low cost China tablets I need to edit a file located in
system/build.prop
replace the text
ro.property.tabletUI=true
with
#ro.property.tabletUI=true
(I comment the line). After that, I can get a full screen using
android:theme="#android:style/Theme.Black.NoTitleBar.Fullscreen"
for each activity in the minfest.xml
This solution Is good only if you sell tablets with your application and needs root privileges to edit the system/build.prop. So it's not a solution for all, so please do not downvote this little contribute.
EDIT:
I noticed that my tablets have hardware buttons (Home, menĂ¹ and back) on the frames. So Android lets me to hide the system bar. I tryed with other tablets that haven't hardware buttons without success.
Google intends Android to be used for consumers only. They integrated the System UI bar more tightly into Android ICS (4.0) to prevent people from rooting the device and killing the bar that way. Attempting to delete the system bar process will prevent the OS from booting fully.
If you want to restrict users from accessing the home screen, then you are out of luck with Android ICS. I would suggest finding a tablet manufacture who will preload the device with Android 2.3. Either that, or use a rooted Android 3.x device.
If you intend to use Android for kiosk or locked down devices, then you would be better off targeting an OS that is a bit more open.
I found a solution that, in my use case, works like a charm by hiding the menu bar even on a NOT ROOTED device:
setting this flag
layoutparams.flags = 0x80000000 | layoutparams.flags;
to my window's layout parameters simply does the trick!
Here's the complete snippet i used:
Window window = getWindow();
android.view.WindowManager.LayoutParams layoutparams = window.getAttributes();
layoutparams.flags = 0x80000000 | layoutparams.flags;
window.setAttributes(layoutparams);
in my Activity onCreate.
To find out this I reverse engeneered a non-system Apk I found that was somehow able to do that.
According to the official documentation:
http://developer.android.com/reference/android/view/WindowManager.LayoutParams.html#FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS
that "0x80000000" is the FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS introduced as a system constant in Api level 21, and it basically indicates that "this Window is responsible for drawing the background for the system bars." and since i'm not manually drawing any system bar, no menu bar is shown.
I only tested this on a pair of Moverio BT-200 running Android ICS 4.0.3 because that is the device i'm currently working on and also because right now i don't have other device running Api levels prior to 19 under my hands to test it.
There is a workaround to disable menu bar (not hide) in all most all tablets without rooting. But this is bit tricky, but it works clean. Several well known apps in the market at the moment using this strategy to achieve this disable menu bar feature for their apps.
Grant admin privilege (need one time user involvement to activate).
Set password & lock the device using device admin profile api programatically.
Then load what ever the UIs on top of the native lock screen. (Of course this will show background lock screen whenever a transition happens between activities. But if logic is organized well, then it will be smooth & less noticed by the user)
When need to enable back, reset password to "" using resetPassword("", 0) of device policy manager object.
To complement the answers already given, and in case it is useful for someone needing a similar behaviour, there is this tutorial for android devices 4.0 and higher, it tells you how to hide the navigation bar and the status bar (they will reappear when the screen is touched again):
https://developer.android.com/training/system-ui/navigation.html
I realize it is not what you need exactly, but might be useful for someone else looking at this problem.

True fullscreen in AIR on Android?

I am developing an interactive video application using AIR on Android. The application is for at-risk communities to encourage them to get common cancer screenings, and will be deployed in clinics. I am testing and eventually deploying on the ASUS TF300, a 1280x800 ICS tablet.
When I put the app in fullscreen mode through a variety of methods it looks great, except the bottom bar of buttons does not hide, and instead displays as a black bar with "stealth" dots where the buttons normally present. I need to completely hide this bar so that users will not inadvertently navigate to home or other Android views.
I am having trouble solving this problem because I am not sure - Is it possible to EVER hide this bottom bar in ICS? If so, is there a known method for achieving this in AIR?
Many thanks for any advice.
related - what is the official name for this bottom bar of buttons in ICS?
I had the same issue, where I had to hide the system bar in a digital signage app for Android sticks for TV. I used distriqt native extension called Application.
Then it was as simple as using UI_NAVIGATION_HIDE in ApplicationDisplayModes class along with FULLSCREEN in my init function.
Just so you know, it is a paid extension, but worth buying the package as you get a lot of other good stuff along with it. I wasn't sure on where to begin with building my own ANE, so I went with distinqt.
Yes, it should be possible. After a few days of beating my head against the wall, I have this working on a cheap, Chinese android stick running ICS. The gist is that you need to create an Adobe Native Extension that runs the follow lines of Java:
Window window = context.getActivity().getWindow();
window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
Of course, you need about a dozen files of boilerplate to run those lines. Here's a good tutorial on building native extensions.
The name is system bar.
http://developer.android.com/design/get-started/ui-overview.html
Unless you are using a rooted device you can't really removed them as they are user navigation controls.
See this SO question:
Is there a way to hide the system/navigation bar in Android ICS

Categories

Resources