Testing Doze feature (Android 6.0 Marshmallow) in Genymotion - android

I've tried the commands from Google
adb shell dumpsys battery unplug
adb shell dumpsys deviceidle step
on both "PREVIEW - Google Nexus 6P - 6.0.0 - API 23 - 1440x2560" and "PREVIEW - Google Nexus 5X - 6.0.0 - API 23 - 1080x1920" virtual devices from Genymotion but unfortunately cannot put anyone to idle mode. Always after second command I see Stepped to: ACTIVE.
Then trying
adb shell dumpsys deviceidle force-idle
I see Unable to go idle; not enabled. This is strange because Genymotion states in release note (https://www.genymotion.com/#!/release-notes) for version 2.6.0, which I use, that "Doze now works properly."
Is there anyone who managed to use and test Doze in Genymotion? Should I use some other commands?

I'm part of the Genymotion team.
The release note is not correct and our patch for Doze feature has not been released on the preview. Sorry for this mistake.
We will soon release Marshmallow officially and it will include Doze feature. On this future release you will need to enable Doze manually, at each device startup, by running the following command:
adb shell dumpsys deviceidle enable
Then, all the usual commands will work perfectly:
adb shell dumpsys battery unplug
adb shell dumpsys deviceidle step
UPDATE: The release has been done, Doze is available now on Genymotion devices.

Related

Android 7.1.1 multi-user support in emulator

I tried to get the multi-user support for my Android 7.1.1 AOSP emulator build on Ubuntu 16.04 64bit. The build gets run with lunch aosp_x86-eng and following the emulator with emulator64-x86.
I tried this solution but with no success:
adb shell
su
setprop fw.max_users 5
The Icon is visible for the first time when I wipe down the status bar, but disappears on releasing it:
Same like here:
adb shell setprop fw.show_multiuserui 1
adb shell setprop fw.max_users 4
I also tried to add an user by adb but without success.
After executing the commands I test it by using:
su
pm get-max-users
result is:
Maximum supported users: 4
Is there a barrier or something like that? Or do I need to edit the build? If I need to root the system, why is the property set to 4 users? And why is the icon shown on the first wipe and disappears after releasing?
Thanks!

Visual Studio Android Emulator - Mashmallow Power State

I am using VS Android Emulator for Marshmallow and want to test my application (Xamarin) in Doze mode. The problem is the Emulator never seems to go to Doze mode.
Using adb I have issued the following commands, repeat step 2 again and again but the end result is always "Stepped to: ACTIVE".
adb shell dumpsys battery unplug.
adb shell dumpsys deviceidle step
Any help is appreciated.
Here is the answer. In all documentation, post, forum they don't mention that you have to enable the deviceidle state. Issue the following then run the two commands above. Thanks.
adb shell dumpsys deviceidle enable

How to force Doze on Marshmallow?

Everything seems to point to these two commands:
adb shell dumpsys battery unplug
adb shell dumpsys deviceidle step
I followed the instructions on my Nexus 6 running the Marshmallow official release. I plug in my phone to my test machine. I set up my app for testing the piece I want to test with doze. I turn off my screen. After running battery unplug above I get no output so I assume it works, but every time I run deviceidle step the output is always Stepped to: ACTIVE.
I'm not sure if it matters, but the particular feature of my app I'm trying to test is an alarm I'm setting that should wake the phone out of Doze. I'm wanting my device to be mid-doze when my PendingIntent scheduled by AlarmManager.setAlarmClock goes off. Could that prevent my device from entering Doze?
use below commands to force idle you device.
To unplug battery
adb shell dumpsys battery unplug
You can use below commands to Force Idle state
adb shell dumpsys deviceidle force-idle
or
adb shell dumpsys deviceidle enable
Check you are in doze more or not with below command
adb shell dumpsys deviceidle enabled
disable mode:
adb shell dumpsys deviceidle disable
Reset device battery status:
adb shell dumpsys battery reset
The Greenify app has an experimental feature to instantly turn on Doze mode when the screen turns off. You might need root for this however. Greenify runs in root AND non-root modes. Hope this helps. Good luck!

How to shift device in Doze Mode (Android Preview M / Marshmallow)?

I followed steps described here:
https://developer.android.com/preview/testing/guide.html#doze-standby
Circumstances:
Android Debug Bridge version 1.0.32
Nexus 9 with Preview M
Shell:
$ adb shell dumpsys battery unplug
=> worked, device unplugged
$ adb shell dumpsys deviceidle step
=> Output: Stepped to: ACTIVE
$ adb shell dumpsys deviceidle -h
=> does not work => Output:
Device idle controller (deviceidle) dump options:
[-h] [CMD]
-h: print this help text.
Commands:
step
disable
enable
whitelist
I tried it with:
adb shell dumpsys deviceidle enable
But it didn't work.
So my question, as mentioned above, how to shift the device in Doze-Mode?
What did i make wrong?
EDIT - JUNE, 2016:
New Link:
https://developer.android.com/training/monitoring-device-state/doze-standby.html
There is a better way to achieve this in the new releases:
$ adb shell dumpsys deviceidle force-idle
No need to unplug from power, no need to wait for the screen to turn off.
Ok, i got it. The trick was to turn the screen off! After that
$ adb shell dumpsys deviceidle step
outputs:
IDLE_PENDING
then
SENSING
then
IDLE
then
IDLE_MAINTENANCE
then
IDLE
then
IDLE_MAINTENANCE
and so on...
Many thanks to this site:
https://newcircle.com/s/post/1739/2015/06/12/diving-into-android-m-doze
Yes, it appears that Google's developer testing guideline is incorrect. I just recently discovered this as well and posted a bug about it here with the correct steps to get the device to idle (aka doze).
$ adb shell dumpsys deviceidle -h
This command only outputs a help message like common unix program.
IDLE means Doze mode.
In the article you linked, you can regard Doze mode as device idle mode.
You can find my full answer posted on the similar topic here:
How to test Doze Mode on Android?
Idle State - In order to put the device into an Idle state you can use the following adb commands:
>adb shell dumpsys battery unplug
>adb shell dumpsys deviceidle force-idle
Active State - In order to put the device back into the Active state you may simulate the following key event:
> adb shell input keyevent KEYCODE_WAKEUP
I also needed a quick option to toggle between Active and Idle states so I wrote a batch script adbIdleModeSwitch.bat for these purposes, you may download and use it: https://drive.google.com/file/d/0B81qFnPX_eUUYTMxOTd1UG94NVk/view

genymotion 2.0.3: add a restricted profile

I'm running a Nexus 7 emulated device (API 18) using the Genymotion 2.0.3 emulator. And I have the google APIs installed and signed into a google account.
How do I add a restricted user profile? There is no Users menu item in the settings.
You can enable it via adb:
$ adb shell setprop fw.max_users 4
To make it work even after reboot you can do next:
$ adb remount
$ adb shell
# echo "fw.max_users=4" >> /system/build.prop
Since Genymotion is a rooted device, an alternate approach would be to use
an app such as "4.2 Multiple User Enabler". This particular app is
available in the Play Store and is also open source:
https://github.com/SferaDev/4.2MultiuserEnabler.

Categories

Resources