[Proj] Tired of your phone going to sleep during calls. Let's find a sulotion. - G1 Android Development

Seriously... does anyone besides me get super irritated when the G1 shuts the screen off during calls? When you are calling automated lines or checking voicemail it's like the biggest pain in the ass... anyone know of a setting or something to stop the phone from turning screen off during calls?

Closes app you can get now is Shake Awake. It won't keep your screen on, but it will turn it on when you move (shake) the phone http://www.cyrket.com/package/com.maplekeycompany.apps.shake

I have been griping about this very problem for almost a year now. Shake awake is nice, but how about just changing a setting so that the phone screen DOES NOT SLEEP during a call? Anyone know where this would be?

There is no such setting. That question has been asked many times before, I'm sure someone would have worked it out if it was possible.

OK. I think I have found the culprit. This is what happens when the screen is shutting itself off during a call:
D/PhoneApp( 185): updateWakeState: keepScreenOn = false (isRinging false, showingDisc false)
D/SurfaceFlinger( 134): About to give-up screen, flinger = 0x17b200
Just a few changes should do the trick. I'll try to work on this.

You'd be a hero for many people if you figured this out

Looking at PhoneApp.java, this seems to be getting closer:
559 /**
560 * Controls how quickly the screen times out.
561 *
562 * The poke lock controls how long it takes before the screen powers
563 * down, and therefore has no immediate effect when the current
564 * WakeState (see {@link PhoneApp#requestWakeState}) is FULL.
565 * If we're in a state where the screen *is* allowed to turn off,
566 * though, the poke lock will determine the timeout interval (long or
567 * short).
568 *
569 * @param shortPokeLock tells the device the timeout duration to use
570 * before going to sleep
571 * {@link com.android.server.PowerManagerService#SHORT_KEYLIGHT_DELAY}.
572 */
573 /* package */ void setScreenTimeout(ScreenTimeoutDuration duration) {
574 if (DBG) Log.d(LOG_TAG, "setScreenTimeout(" + duration + ")...");
575
576 // make sure we don't set the poke lock repeatedly so that we
577 // avoid triggering the userActivity calls in
578 // PowerManagerService.setPokeLock().
579 if (duration == mPokeLockSetting) {
580 return;
581 }
582 mPokeLockSetting = duration;
583
584 // This is kind of convoluted, but the basic thing to remember is
585 // that the poke lock just sends a message to the screen to tell
586 // it to stay on for a while.
587 // The default is 0, for a long timeout and should be set that way
588 // when we are heading back into a the keyguard / screen off
589 // state, and also when we're trying to keep the screen alive
590 // while ringing. We'll also want to ignore the cheek events
591 // regardless of the timeout duration.
592 // The short timeout is really used whenever we want to give up
593 // the screen lock, such as when we're in call.
594 int pokeLockSetting = LocalPowerManager.POKE_LOCK_IGNORE_CHEEK_EVENTS;
595 switch (duration) {
596 case SHORT:
597 // Set the poke lock to timeout the display after a short
598 // timeout (5s). This ensures that the screen goes to sleep
599 // as soon as acceptably possible after we the wake lock
600 // has been released.
601 if (DBG) Log.d(LOG_TAG, "setting short poke lock");
602 pokeLockSetting |= LocalPowerManager.POKE_LOCK_SHORT_TIMEOUT;
603 break;
604
605 case MEDIUM:
606 // Set the poke lock to timeout the display after a medium
607 // timeout (15s). This ensures that the screen goes to sleep
608 // as soon as acceptably possible after we the wake lock
609 // has been released.
610 if (DBG) Log.d(LOG_TAG, "setting medium poke lock");
611 pokeLockSetting |= LocalPowerManager.POKE_LOCK_MEDIUM_TIMEOUT;
612 break;
613
614 case DEFAULT:
615 default:
616 // set the poke lock to timeout the display after a long
617 // delay by default.
618 // TODO: it may be nice to be able to disable cheek presses
619 // for long poke locks (emergency dialer, for instance).
620 if (DBG) Log.d(LOG_TAG, "reverting to normal long poke lock");
621 break;
622 }
623
624 // Send the request
625 try {
626 mPowerManagerService.setPokeLock(pokeLockSetting, mPokeLockToken, LOG_TAG);
627 } catch (RemoteException e) {
628 }
629 }
Click to expand...
Click to collapse

please please get this done... I'm even willing to donate I really want this... soooooooooooooooo tired of pressing MENU every time I need to get anywhere... and with some of these automated lines it can be like 10+ times each call...

Installing it on my phone now and keeping my fingers crossed...

I think there are more crossed fingers than just yours

derfolo said:
Installing it on my phone now and keeping my fingers crossed...
Click to expand...
Click to collapse
That's one long install. I hope you didn't completely trash your phone

I thought the Power Manager app had an option to keep the screen awake during calls...well at least the trial version DID (before it became a trial version)
damn wish i hadnt erased that ASTRO backup file...
I could be wrong but how can i check if I dont wanna buy the app.

dammit I want this!!! baaaaaaaaaaaad!!!

You should really try the power manager app like someone else mentioned. There is an option for keeping the phone awake, albeit only for 2 mins, but it should do the trick.

Hi all,
Sorry for the delay. I had two birthday parties to attend tonight, and my wife was not going to let me get out of it.
The short story is that my original hack did not work correctly. I incorrectly focused on the SHORT_TIMEOUT, when in fact the one that is happening during calls is the MEDIUM. The bonus is that I think I know what is going on at this point. I will keep trying tomorrow. When I am done, I will have a phone.apk that will replace the current one. oooh.

derfolo said:
Hi all,
Sorry for the delay. I had two birthday parties to attend tonight, and my wife was not going to let me get out of it.
The short story is that my original hack did not work correctly. I incorrectly focused on the SHORT_TIMEOUT, when in fact the one that is happening during calls is the MEDIUM. The bonus is that I think I know what is going on at this point. I will keep trying tomorrow. When I am done, I will have a phone.apk that will replace the current one. oooh.
Click to expand...
Click to collapse
I love you man

oneG said:
I thought the Power Manager app had an option to keep the screen awake during calls...well at least the trial version DID (before it became a trial version)
damn wish i hadnt erased that ASTRO backup file...
I could be wrong but how can i check if I dont wanna buy the app.
Click to expand...
Click to collapse
You'd spend a buck on snickers or coke without even thinking - why not buy .99 app?
But if you want to just test it, you can get it and then return it within 24 hours.
I didn't know it had that feature, but even now that I know it, I don't want a full-blown app just to change screen timeout.

exactly... I don't want an application slowing down my phone all the time and also messing with the boot just to have an option that should be on the phone already and most likely can be sorta easily changed...

Send me a patch when you've got it working and I'll add it to my build if you would like!

cyanogen said:
Send me a patch when you've got it working and I'll add it to my build if you would like!
Click to expand...
Click to collapse
EDIT: Got it done! See my post below for the Phone.apk attachment...

Related

where is the backlight setting?

where can i dim the backlight? i'm searching for the backlight settings, but haven't found anything.
any reg tweak?
thx very much.
do u need to check some key register.....
i guess not. did some research, seems you can't set the backlight in any way.
poor, but true.
under power settings there is 'backlight off' and 'display off'.
i set the backlight off to quick (15secs) but display off to 2 minutes. The display is quite readable indoors with the backlight off (I suspect it is on a little - so the description in settings is not accurate).
Hopefully a firmware update will bring proper brightness control. Although I rememer my C500 and C550 not having it as well.
rgds
Im not sure if the hardware supports multiple levels for backlight.
I tried an app to test.(only tested on vda2 wm 5.0)
the only thing that happens is off or on.
but it works on ppc version!(didnt try on real ppc , but the emulator does switch light conditions! nothing happens on sp emulator)
no, unfortunately it's not supported.
big, big disadvantage!
Verify this Keyreg....and update on your SP.
HKEY_CURRENT_USER\Control Panel\Backlight\
- AcTimeout = 60
- AutoSensor = 1
- BatteryBacklight = 40
- BatteryTimeout = 15
- m_ACTimeout = 0
- m_BatteryTimeout = 0
Byeee
Sky_Lab

[Q] Screen saver for when plugged in??

I've done about 30 min of research into this and haven't found any app doing this. Just a round about way using Tasker or with no delay with alarm clock plus.
I've never made an app before so I have no idea how technically difficult this could/would be...
If phone is unplugged & inactive for time = x, then screen off as per normal.
If phone is plugged in & inactive for time = x, then launch live-wallpaper/photo/app.
Maybe working unlocking into screensaver exit if possible?
I don't have a scooby if this is do-able, easy or impossible?

[Root] Doze Settings Editor (Android Marshmallow Only)

Android Marshmallow Doze Settings Editor
Requires Root
This app is a simple editor of the settings or parameters which affect the operation of Doze.
If no root is available then it will offer an ADB command that will modify the doze settings.
Because there is no root on open it will always load the default settings.
Changelog - v6.0
You can now add your own custom profiles.
Added tuhinxp04's profile
Bugfix - No longer crashes when device settings unavailable. Will change to non root mode.
Bugfix - Info screen now shows default in current display type
Bugfix - Info screen now shows location accuracy with meters
Changelog - v5.0
New built in profiles
Bugfix - Back arrow in settings not closing activity
The next post contains descriptions of each parameter.
Source Code
https://github.com/p0isonra1n/Doze-Settings-Editor
Disclaimer
I accept no responsibility for any outcome that this app may cause. Use at your own risk.
Parameter Descriptions
These are all direct from the Doze source code.
Inactive Timeout - inactive_to
This is the time, after becoming inactive, at which we start looking at the motion sensor to determine if the device is being left alone. We don't do this immediately after going inactive just because we don't want to be continually running the significant motion sensor whenever the screen is off.
Sensing Timeout - sensing_to
If we don't receive a callback from AnyMotion in this amount of time + locating_to, we will change from STATE_SENSING to STATE_INACTIVE, and any AnyMotion callbacks while not in STATE_SENSING will be ignored.
Locating Timeout - locating_to
This is how long we will wait to try to get a good location fix before going in to idle mode.
Location Accuracy - location_accuracy
The desired maximum accuracy (in meters) we consider the location to be good enough to go on to idle. We will be trying to get an accuracy fix at least this good or until locating_to expires.
Motion Inactive Timeout - motion_inactive_to
This is the time, after seeing motion, that we wait after becoming inactive from that until we start looking for motion again.
Idle After Inactive Timeout - idle_after_inactive_to
This is the time, after the inactive timeout elapses, that we will wait looking for significant motion until we truly consider the device to be idle.
Idle Pending Timeout - idle_pending_to
This is the initial time, after being idle, that we will allow ourself to be back in the IDLE_PENDING state allowing the system to run normally until we return to idle.
Max Idle Pending Timeout - max_idle_pending_to
Maximum pending idle timeout (time spent running) we will be allowed to use.
Idle Pending Factor - idle_pending_factor
Scaling factor to apply to current pending idle timeout each time we cycle through that state.
Idle Timeout - idle_to
This is the initial time that we want to sit in the idle state before waking up again to return to pending idle and allowing normal work to run.
Max Idle Timeout - max_idle_to
Maximum idle duration we will be allowed to use.
Idle Factor - idle_factor
Scaling factor to apply to current idle timeout each time we cycle through that state.
Min Time to Alarm - min_time_to_alarm
This is the minimum time we will allow until the next upcoming alarm for us to actually go in to idle mode.
Max Temp App Whitelist Duration - max_temp_app_whitelist_duration
Max amount of time to temporarily whitelist an app when it receives a high tickle.
MMS Temp App Whitelist Duration - mms_temp_app_whitelist_duration
Amount of time we would like to whitelist an app that is receiving an MMS.
SMS Temp App Whitelist Duration - sms_temp_app_whitelist_duration
Amount of time we would like to whitelist an app that is receiving an SMS.
Extra Infomation
Difference: Doze and App Standby (developer.android.com)
Some tests and issues: code.google.com
Requires root.... so.... source code?
Going to play with this on my Oneplus one for some time.
Thanks for your work m8.
9THX!
Does it show the default numbers or does it read out the current settings?
E.g. can we see what is changed with aggressive doze from greenify?
Edit: aggressive doze seems not edit directly these strings ...
----------------------------------------------------------------------------------------------
note:
whitelist is only for app Standby!
Difference: Doze and App Standby (developer.android.com)
Some tests and issues: code.google.com
Some add links:
Power Management (source.android.com)
Doze and App Standby (developer.android.com)
Doze steps (xda)
Understanding what Doze mode means for your app - Pro-tip by +Joanna Smith (G+)
time explanation in more simple english (xda)
what we found out:
*timeout means not max. time - so the system check only from time to time if there are timeouts over, then it will stop - this is not exactly triggered (only linux sw timer)
** if e.g. sensing_timeout = 0 it will stop sensing after the next control cycle (SystemClock Interrupt AlarmTime) - although it is 0, it will check the motion sensor for few seconds
*idle mode (doze) stops if
**idle_to is reached or
**phone detect any significant motion (!)
**some tests from @italia0101
idle def (source code):
Code:
/** Device is in the idle state, trying to stay asleep as much as possible. */
Device idle controller (deviceidle) dump options:
(adb shell dumpsys battery unplug)
Code:
adb shell dumpsys deviceidle -h
Device idle controller (deviceidle) dump options:
[-h] [CMD]
-h: print this help text.
Commands:
step
Immediately step to next state, without waiting for alarm.
force-idle
Force directly into idle mode, regardless of other device state.
[B] Use "step" to get out.[/B]
disable
Completely disable device idle mode.
enable
Re-enable device idle mode after it had previously been disabled.
enabled
Print 1 if device idle mode is currently enabled, else 0.
whitelist
Print currently whitelisted apps.
whitelist [package ...]
Add (prefix with +) or remove (prefix with -) packages.
tempwhitelist [package ..]
Temporarily place packages in whitelist for 10 seconds.
[GUIDE][ADB]Easiest How to use adb, logcat, etc for noobs and newbies
adb shell dumpsys deviceidle - output:
Code:
adb shell dumpsys deviceidle
Settings:
inactive_to=+30m0s0ms
sensing_to=+4m0s0ms
locating_to=+30s0ms
location_accuracy=20.0m
motion_inactive_to=+10m0s0ms
idle_after_inactive_to=+30m0s0ms
idle_pending_to=+5m0s0ms
max_idle_pending_to=+10m0s0ms
idle_pending_factor=2.0
idle_to=+60m0s0ms
max_idle_to=+6h0m0s0ms
idle_factor=2.0
min_time_to_alarm=+60m0s0ms
max_temp_app_whitelist_duration=+5m0s0ms
mms_temp_app_whitelist_duration=+60s0ms
sms_temp_app_whitelist_duration=+20s0ms
Whitelist (except idle) system apps:
com.android.providers.downloads
com.android.vending
com.google.android.gms
Whitelist system apps:
com.google.android.gms
Whitelist (except idle) all app ids:
10008
10011
10020
Whitelist all app ids:
10011
mEnabled=true
mForceIdle=false
mSigMotionSensor={Sensor name="Significant Motion Detector", vendor="QTI", version=1, type=17, maxRange=1.0, resolution=1.0, power=0.3999939, minDelay=-1}
mCurDisplay=Display id 0: DisplayInfo{"Integrierter Bildschirm", uniqueId "local:0", app 1080 x 1823, real 1080 x 1920, largest app 1835 x 1769, smallest app 1080 x 1026, mode 1, defaultMode 1, modes [{id=1, width=1080, height=1920, fps=60.0}], rotation 0, density 360 (442.451 x 443.345) dpi, layerStack 0, appVsyncOff 7500000, presDeadline 12666667, type BUILT_IN, state OFF, FLAG_SECURE, FLAG_SUPPORTS_PROTECTED_BUFFERS}, DisplayMetrics{density=2.25, width=1080, height=1823, scaledDensity=2.25, xdpi=442.451, ydpi=443.345}, isValid=true
mScreenOn=false
mCharging=false
mSigMotionActive=false
mSensing=false mNotMoving=false
mLocating=false mHaveGps=false mLocated=false
mState=INACTIVE
mInactiveTimeout=+5m0s0ms
mNextAlarmTime=+4m57s175ms
MOTION_INACTIVE_TIMEOUT
Code:
@Override
public void onTrigger(TriggerEvent event) {
synchronized (DeviceIdleController.this) {
active = false;
motionLocked();
}
}
@Override
public void onSensorChanged(SensorEvent event) {
synchronized (DeviceIdleController.this) {
mSensorManager.unregisterListener(this, mMotionSensor);
active = false;
motionLocked();
}
}
void motionLocked() {
// The motion sensor will have been disabled at this point
handleMotionDetectedLocked(mConstants.[B]MOTION_INACTIVE_TIMEOUT[/B], "motion");
}
void handleMotionDetectedLocked(long timeout, String type) {
// The device is not yet active, so we want to go back to the pending idle
// state to wait again for no motion. Note that we only monitor for motion
// after moving out of the inactive state, so no need to worry about that.
if (mState != STATE_ACTIVE) {
scheduleReportActiveLocked(type, Process.myUid());
mState = STATE_ACTIVE;
[B]mInactiveTimeout = timeout; [/B]
EventLogTags.writeDeviceIdle(mState, type);
becomeInactiveIfAppropriateLocked();
}
}
void becomeInactiveIfAppropriateLocked() {
if (((!mScreenOn && !mCharging) || mForceIdle) && mEnabled && mState == STATE_ACTIVE) {
// Screen has turned off; we are now going to become inactive and start
// waiting to see if we will ultimately go idle.
mState = STATE_INACTIVE;
resetIdleManagementLocked();
scheduleAlarmLocked([B]mInactiveTimeout[/B], false);
EventLogTags.writeDeviceIdle(mState, "no activity");
}
}
void scheduleAlarmLocked(long delay, boolean idleUntil) {
mNextAlarmTime = SystemClock.elapsedRealtime() + delay;
if (idleUntil) {
mAlarmManager.setIdleUntil(AlarmManager.ELAPSED_REALTIME_WAKEUP,
mNextAlarmTime, mAlarmIntent);
} else {
mAlarmManager.set(AlarmManager.ELAPSED_REALTIME_WAKEUP,
mNextAlarmTime, mAlarmIntent);
}
}
SENISING_TIMEOUT
Code:
switch (mState) {
case STATE_INACTIVE:
// We have now been inactive long enough, it is time to start looking
// for motion and sleep some more while doing so.
...
break;
case STATE_IDLE_PENDING:
mState = STATE_SENSING;
EventLogTags.writeDeviceIdle(mState, "step");
scheduleSensingAlarmLocked(mConstants.[B]SENSING_TIMEOUT[/B]);
cancelSensingAlarmLocked();
cancelLocatingLocked();
mAnyMotionDetector.checkForAnyMotion();
mNotMoving = false;
mLocated = false;
mLastGenericLocation = null;
mLastGpsLocation = null;
break;
case STATE_SENSING:
...
}
void scheduleAlarmLocked(long delay, boolean idleUntil) {
mNextAlarmTime = SystemClock.elapsedRealtime() + delay;
if (idleUntil) {
mAlarmManager.setIdleUntil(AlarmManager.ELAPSED_REALTIME_WAKEUP,
mNextAlarmTime, mAlarmIntent);
} else {
mAlarmManager.set(AlarmManager.ELAPSED_REALTIME_WAKEUP,
mNextAlarmTime, mAlarmIntent);
}
}
// mAlarmManager.setIdleUntil * Schedule an idle-until alarm, which will keep the alarm manager idle until the given time.
// mAlarmManager.set * Schedule an alarm.; If the stated trigger time is in the past, the alarm will be triggered immediately.
//android/server/AnyMotionDetector.java
public AnyMotionDetector(AlarmManager am, PowerManager pm, Handler handler, SensorManager sm,
DeviceIdleCallback callback) {
mAlarmManager = am;
mWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, TAG);
mHandler = handler;
mSensorManager = sm;
mAccelSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
mMeasurementInProgress = false;
mState = STATE_INACTIVE;
mCallback = callback;
mRunningStats = new RunningSignalStats();
mNumSufficientSamples = (int) Math.ceil(
((double)ORIENTATION_MEASUREMENT_DURATION_MILLIS / SAMPLING_INTERVAL_MILLIS));
}
private final class MotionListener extends TriggerEventListener
implements SensorEventListener {
...
}
private final SensorEventListener mListener = new SensorEventListener() {
@Override
public void onSensorChanged(SensorEvent event) {
int status = RESULT_UNKNOWN;
synchronized (mLock) {
Vector3 accelDatum = new Vector3(SystemClock.elapsedRealtime(), event.values[0],
event.values[1], event.values[2]);
mRunningStats.[B]accumulate[/B](accelDatum);
// If we have enough samples, stop accelerometer data acquisition.
if (mRunningStats.getSampleCount() >= mNumSufficientSamples) {
status = stopOrientationMeasurementLocked();
}
}
if (status != RESULT_UNKNOWN) {
mCallback.onAnyMotionResult(status);
}
}
@Override
public void onAccuracyChanged(Sensor sensor, int accuracy) {
}
};
private int stopOrientationMeasurementLocked() {
int status = RESULT_UNKNOWN;
if (mMeasurementInProgress) {
mSensorManager.unregisterListener(mListener);
mHandler.removeCallbacks(mMeasurementTimeout);
if (mWakeLock.isHeld()) {
mWakeLock.release();
}
long detectionEndTime = SystemClock.elapsedRealtime();
mMeasurementInProgress = false;
mPreviousGravityVector = mCurrentGravityVector;
mCurrentGravityVector = mRunningStats.getRunning[B]Average[/B]();
mRunningStats.reset();
status = getStationaryStatus();
if (status != RESULT_UNKNOWN) {
mState = STATE_INACTIVE;
} else {
/*
* Unknown due to insufficient measurements. Schedule another orientation
* measurement.
*/
Message msg = Message.obtain(mHandler, mSensorRestart);
msg.setAsynchronous(true);
mHandler.sendMessageDelayed(msg, ORIENTATION_MEASUREMENT_INTERVAL_MILLIS);
}
}
return status;
}
/*
* Updates mStatus to the current AnyMotion status.
*/
public int getStationaryStatus() {
if ((mPreviousGravityVector == null) || (mCurrentGravityVector == null)) {
return RESULT_UNKNOWN;
}
Vector3 previousGravityVectorNormalized = mPreviousGravityVector.normalized();
Vector3 currentGravityVectorNormalized = mCurrentGravityVector.normalized();
float angle = previousGravityVectorNormalized.angleBetween(currentGravityVectorNormalized);
if ((angle < [B]THRESHOLD_ANGLE[/B]) && (mRunningStats.getEnergy() < [B]THRESHOLD_ENERGY[/B])) {
return [B]RESULT_STATIONARY[/B];
} else if (Float.isNaN(angle)) {
/**
* Floating point rounding errors have caused the angle calcuation's dot product to
* exceed 1.0. In such case, we report RESULT_MOVED to prevent devices from rapidly
* retrying this measurement.
*/
return [B]RESULT_MOVED[/B];
}
long diffTime = mCurrentGravityVector.timeMillisSinceBoot -
mPreviousGravityVector.timeMillisSinceBoot;
if ([B]diffTime [/B]> [B]STALE_MEASUREMENT_TIMEOUT_MILLIS[/B]) {
return [B]RESULT_UNKNOWN[/B];
}
return [B]RESULT_MOVED[/B];
}
/** Current measurement state. */
private int mState;
/** Threshold angle in degrees beyond which the device is considered moving. */
private final float THRESHOLD_ANGLE = 2f;
/** Threshold energy above which the device is considered moving. */
private final float THRESHOLD_ENERGY = 5f;
/** The duration of the accelerometer orientation measurement. */
private static final long ORIENTATION_MEASUREMENT_DURATION_MILLIS = 2500;
/** The maximum duration we will collect accelerometer data. */
private static final long ACCELEROMETER_DATA_TIMEOUT_MILLIS = 3000;
/** The interval between accelerometer orientation measurements. */
private static final long ORIENTATION_MEASUREMENT_INTERVAL_MILLIS = 5000;
/**
* The duration in milliseconds after which an orientation measurement is considered
* too stale to be used.
*/
private static final int STALE_MEASUREMENT_TIMEOUT_MILLIS = 2 * 60 * 1000;
/** The accelerometer sampling interval. */
private static final int SAMPLING_INTERVAL_MILLIS = 40;
[B][/B]
/android/server/DeviceIdleController.java
motionLocked() https://android.googlesource.com/pl...android/server/DeviceIdleController.java#1402
scheduleAlarmLocked https://android.googlesource.com/pl...android/server/DeviceIdleController.java#1402
sensing scheduleAlarmLocked https://android.googlesource.com/pl...android/server/DeviceIdleController.java#1490
/android/hardware/Sensor.java
description of a significant motion trigger sensor (TYPE_SIGNIFICANT_MOTION = 17) https://android.googlesource.com/pl...er/core/java/android/hardware/Sensor.java#305
mPower: https://android.googlesource.com/pl...er/core/java/android/hardware/Sensor.java#721
SensorPrintString https://android.googlesource.com/pl...er/core/java/android/hardware/Sensor.java#848
/android/hardware/SensorManager.java
cancelTriggerSensor https://android.googlesource.com/pl...java/android/hardware/SensorManager.java#1534
/android/server/AnyMotionDetector.java
constant: https://android.googlesource.com/pl.../com/android/server/AnyMotionDetector.java#64
I think with the string sensing_to = 0 we could deaktivate any motion for doze.
Could that be right?
Im not sure if all settings (pic) make sense... :/
original:
test:
final:
I will try it (a better "aggressiv doze")
Are the numbers in this app in seconds?
Sent from my Nexus 6 using XDA Free mobile app
freebee269 said:
Are the numbers in this app in seconds?
Sent from my Nexus 6 using XDA Free mobile app
Click to expand...
Click to collapse
Milliseconds e.g. 600000 means 10min
If you have greenify beta installed you might want to disable doze setting as it may affect this app changes.
Sent from my Nexus 6 using XDA Free mobile app
freebee269 said:
If you have greenify beta installed you might want to disable doze setting as it may affect this app changes.
Sent from my Nexus 6 using XDA Free mobile app
Click to expand...
Click to collapse
I think greenify use such a code:
" adb shell dumpsys deviceidle force-idle" to (only!) force doze mode if screen goes off.
http://forum.xda-developers.com/nexus-6/general/doze-depth-t3234529
So I think we could combine both.
The command "dumpsys deviceidle disable" should disable Doze.
The app will read the current settings but will fall back to loading the defaults if it can't read the settings.
this is what i have so far. greenify uninstalled.
- inactive_to set to 600000 (10min) - the time i want my device to sit before it thinks about going into doze.
- locating_to set to 0 - going into idle (doze) right away
- sensing_to set to 0 - disabling motion and going into inactive right away
- location_accuracy not changed - doesnt matter because we are going into idle right away with locating_to set to 0
- motion_inactive_to set to 0 - disabling motion
- idle_after_inactive_to set to 0 - we are already waiting 10min with inactive_to, no need to wait any longer
- idle_pending_to set to 120000 (2min) - my phone can check for updates for 2min before going back into idle
- max_idle_pending set to 120000 (2min) - my phone can check for updates for 2min before going back into idle
- idle_to set to 1800000 (30min) - the time in idle before my phone can change to idle pending to check for updates
i wonder if these settings will revert to defaults if i reboot? if so, is there a way to automate these settings with initd?
They should stick through a reboot as they are saved in the global settings.
Mkkt Bkkt said:
Going to play with this on my Oneplus one for some time.
Thanks for your work m8.
Click to expand...
Click to collapse
which marshmallow rom are you using on 1+1 ? doze is marshmallow only JFYI
---------- Post added at 10:20 AM ---------- Previous post was at 10:14 AM ----------
freebee269 said:
this is what i have so far. greenify uninstalled.
- inactive_to set to 600000 (10min) - the time i want my device to sit before it thinks about going into doze.
- locating_to set to 0 - going into idle (doze) right away
- sensing_to set to 0 - disabling motion and going into inactive right away
- location_accuracy not changed - doesnt matter because we are going into idle right away with locating_to set to 0
- motion_inactive_to set to 0 - disabling motion
- idle_after_inactive_to set to 0 - we are already waiting 10min with inactive_to, no need to wait any longer
- idle_pending_to set to 120000 (2min) - my phone can check for updates for 2min before going back into idle
- max_idle_pending set to 120000 (2min) - my phone can check for updates for 2min before going back into idle
- idle_to set to 1800000 (30min) - the time in idle before my phone can change to idle pending to check for updates
i wonder if these settings will revert to defaults if i reboot? if so, is there a way to automate these settings with initd?
Click to expand...
Click to collapse
there will be tasker integration i'm sure and depending on ones skill it should be possible to set this up in tasker already, something like day and night profiles. this app will be a runner once people get aware of it. will replace amplify since doze in action beats amplify by far on my N6 and N5. Surprised how fast someone came up with such a thing even though it was clear from day one that it will happen LOL "CHAPEAU" to @p0isonra1n
would be interesting if it is possible to log the doze steps: (Doze - In depth)
*IDLE_PENDING
*SENSING
*IDLE
*IDLE_MAINTENANCE
to find out how doze exactly works with different settings
magnamentis said:
which marshmallow rom are you using on 1+1 ? doze is marshmallow only JFYI
---------- Post added at 10:20 AM ---------- Previous post was at 10:14 AM ----------
there will be tasker integration i'm sure and depending on ones skill it should be possible to set this up in tasker already, something like day and night profiles. this app will be a runner once people get aware of it. will replace amplify since doze in action beats amplify by far on my N6 and N5. Surprised how fast someone came up with such a thing even though it was clear from day one that it will happen LOL "CHAPEAU" to @p0isonra1n
Click to expand...
Click to collapse
I'm using experimental home build.
5% drain over 9hours of deep sleep.
6hours to 8hours SOT max. (Depends on usage..etc)
Mkkt Bkkt said:
I'm using experimental home build.
5% drain over 9hours of deep sleep.
6hours to 8hours SOT max. (Depends on usage..etc)
Click to expand...
Click to collapse
ok, thanks for the feedback
i get 1% drain in 9-10h idle with my nexus 5, 2-3% drain with nexus 6 due to LED always on and i think 5% is slightly on the high side depending.
the 1% on nexus 5 correlate with 0.09% awake which is an absolute record result. the N6 has not only LED always on but as well has wake gestures ( dt2w ) active at all times while the N5 switches that of off charger. unfortunately that tasker intent, albeit it works, cannot be used on N6 because for yet unknown reason it will cause a random reboot a minute or 2 after the intent was executed. still trying to get feedback from the kernel dev as to what could be the reason. congrates for having MM on OPO, my OPO is now used by my dad hence i wait a bit for things to settle until i shall flash MM on that device.
GeraldRudi said:
would be interesting if it is possible to log the doze steps: (Doze - In depth)
*IDLE_PENDING
*SENSING
*IDLE
*IDLE_MAINTENANCE
to find out how doze exactly works with different settings
Click to expand...
Click to collapse
The sequence starts with sensing and locating. Once those 2 timeouts have passed and have not been tripped then it goes to inactive. After inactive timeout passes then it goes into idle which is the actual doze. It periodically wakes itself from doze with idle pending setting for normal phone function then goes back into doze.
Sent from my Nexus 6 using XDA Free mobile app
I am using Cataclysm without root(office mail requirement) on my N6.
Is there a way that we can achieve this in TWRP?
Sent from my Nexus 6 using Tapatalk

The combination of Greenify and Doze Settings seems to be TOO good

* sorry for my English.
Okay guys, I know many of us Android fanboys are obsessed of Dozing and Greenifying and Napping or whatever that keeps their phone deepsleep. I used to be one of them, but now I'm too old and following those guides from Amplify, Tasker, Greenify etc. or whatever it is, has turned out to be too complicated and ridiculous for me. A few days ago I took some time to investigate about doze and decided to mess up with the phone once more.
At first, I made my own doze settings as below:
randomseasons said:
Hi all, after hours and hours of reading (English is not my native language) and testing, I think I have set up a pretty good settings for Doze.
I'm not saying that other profiles are bad, but the matter is that some profiles were set up very early while all of us hadn't understood Doze thoroughly yet
Before we start, let's talk about what I'm aiming for. Basically, doze profiles are aiming for "decrease the time it takes for the phone to sleep, and increase the duration between awake checkups". But is that what we should look forward to? For me, it's reasonable to have my phone sleep soon, however I won't want my phone dead all the time, so I'm heading to "After I leave my phone, wait a short enough time then sleep, but don't let the phone sleep for too long, instead wake it soon enough while decrease the duration of the wakeups. Then after I leave it for a long enough time which really means I'm not using my phone, multiply the time between wakeups."
This way compared to other profiles, for daily use my phone stays more ready (shorter sleeping periods), but it also works less (shorter awake duration), and when I don't use my phone, it will actually catch up with the long sleeping states soon (higher multiply factor).
Here are my settings with that motto in mind:
*** all the parameters are in seconds ***
A) ------------------------------------------
Inactive Timeout - inactive_to: 180
Sensing Timeout - sensing_to: 0
Locating Timeout - locating_to: 0
Location Accuracy - location_accuracy: 50
- This one is easy. I want my phone to sleep right away after 3 minutes of being inactive (screen off), ignoring any motion. You can change the inactive timeout to whatever number that suits you. As we set the location timeout to 0, the Location Accuracy doesn't matter anymore, however I increase it to 50 although just because... I can do it , it's a safe number.
------------------------------------------------
B)-----------------------------------------------
Motion Inactive Timeout - motion_inactive_to: 60
- This number means if the phone checks and finds any motion, it will wait 60 seconds to check for any SIGNIFICANT (strong motion, different from light motion as in the sensing period) motion again. As we don't check for any motion in the beginning, this parameter is useless, however I still set it at 60 seconds, imagine for some particular reason the doze does check for motion (again, this won't happen if the app works as it's supposed to), then I don't want my phone to stay as long as 600 seconds (the default) value, and I don't want my phone to checks too often either, hence I want it to check again after one minute.
Idle After Inactive Timeout - idle_after_inactive_to: 0
- I want my phone to sleep right away after the inactive timeout elapses, I don't want it to wait to check for significant motion, so zero for this.
----------------------------------------------
C) -----------------------------------------------
Idle Pending Timeout - idle_pending_to: 15 seconds.
Max Idle Pending Timeout - max_idle_pending_to: 120 seconds.
Idle Pending Factor - idle_pending_factor: 2.
- This means: when the phone first wakes up (the criteria of when it will happen is in part D below), it will be kept awake for 15 seconds. The second times it will wake up, it will multiply by 2, which is 30 seconds, and so on. The maximum duration of wakeup is 120 seconds.
For me, I want to wake my phone soon enough (see in part D) and decrease the time of the phone being awake. I think 15 seconds for the first time is long enough. You can change it as you want, though :silly:
-----------------------------------------------
D) -----------------------------------------------
Idle Timeout - idle_to: 1200s (default is 3600)
Max Idle Timeout - max_idle_to: 21600s
Idle Factor - idle_factor: 2.
- After 1200s (20 mins), my phone will wake and check for 15 seconds (see part C), then the next time it wakes, it will need 40 minutes before waking up. The maximum time is basically as long as we want so 21600s is okay.
- I'm thinking to change this part to 900s or 720s and idle factor 3, which means that the phone will wake up sooner, at <=15 minutes mark, but after that, the sleeping duration will increase 3 times faster.
------------------------------------------
E) -----------------------------------------------
Min Time to Alarm - min_time_to_alarm: 3600.
This is the minimum time we will allow until the next upcoming alarm for us to actually go in to idle mode.
I don't get what this sentence says, my English sometimes sucks, but I guess it means if the next alarm is within the set number then the phone won't try to go into idle mode. I leave it default.
Max Temp App Whitelist Duration - max_temp_app_whitelist_duration: 20s
Max amount of time to temporarily whitelist an app when it receives a high tickle.
- Set this number whatever you feel like, for me I think 20s is enough.
MMS Temp App Whitelist Duration - mms_temp_app_whitelist_duration: 0
Amount of time we would like to whitelist an app that is receiving an MMS.
- Set this number whatever you feel like, I live in Vietnam, I don't ever use MMS at all so 0 for it.
SMS Temp App Whitelist Duration - sms_temp_app_whitelist_duration: 15s
Amount of time we would like to whitelist an app that is receiving an SMS.
- Set this number whatever you feel like, for me I think 15s is enough.
----------------------------------------------------------------------
BRIEF TEST:
1. Turned the screen off, sent an email to myself within 3 minutes (inactive timeout duration), the phone notified right away, no delay, 7 tries, worked every time.
2. Turned the screen off, waited at least 3 minutes, sent an email to myself, the phone didn't notify right away. If I turned the screen on, of course the email came right away. Out of 8 tries, 6 times the phone notified me between 15min - 20min mark, which followed closely to my rule. 2 times it notified me between 5 - 10 minutes. I think it was because some app woke my phone unexpectedly.
After 2 days, the observation showed me that my Doze Setting has been working decently, I'm quite satisfied. I will keep testing though :silly::victory:
Sorry for my bad English.
Edited: English and grammar.
Click to expand...
Click to collapse
As some guy pointed out, some settings don't act in the way I thought they do, anyway I was having a fantastic result with these settings. My phone was deepsleeping often enough, it woke up after every short time, but each time was short, exactly my purpose.
Then a few days ago, I installed Greenify with xposed, and as it turned out, it's working TOO GOOD. , no matter how many apps I run, Facebook, Messenger, Maps, 8tracks, internet-based apps, clouds etc... (I only Greenify very few of of them), the phone changes its state to idle too strictly and too perfectly and I want it to be. For example, my current doze records were like:
8:00 - turned off my phone
8:04 - 8:19: doze // 14 mins
8:19 - 8:20: awake // 20s
8:20 - 9:00: doze // 40 mins
9:00 - 9:01: doze // 1 mins.
9:01 - 13:00: doze / 4 hours.
etc...
If you have read my doze configs, you can see that my phone now nearly perfect as my settings, I set it to doze after 3 minutes, then after 15 mins wake up 15 secs, then doze for 45 minutes.... etc... without any big difference. The weird thing is that music apps still works perfectly for me. :angel:
Now with Zenfone 2, my phone only drains 3% through the night, with all wifi gps 3G on, and I can still receive notifications ! Zenfone 2 users please come and praise me lol
It's been a long time since I last visited xda so I don't know if anybody has tried this, it would be a shame if I'm sharing what everyone already knew, but if not I guess this post would be very useful for many people.
Cheers, for a better and more simpler Android world ! :silly:
randomseasons said:
* sorry for my English.
Okay guys, I know many of us Android fanboys are obsessed of Dozing and Greenifying and Napping or whatever that keeps their phone deepsleep. I used to be one of them, but now I'm too old and following those guides from Amplify, Tasker, Greenify etc. or whatever it is, has turned out to be too complicated and ridiculous for me. A few days ago I took some time to investigate about doze and decided to mess up with the phone once more.
At first, I made my own doze settings as below:
As some guy pointed out, some settings don't act in the way I thought they do, anyway I was having a fantastic result with these settings. My phone was deepsleeping often enough, it woke up after every short time, but each time was short, exactly my purpose.
Then a few days ago, I installed Greenify with xposed, and as it turned out, it's working TOO GOOD. , no matter how many apps I run, Facebook, Messenger, Maps, 8tracks, internet-based apps, clouds etc... (I only Greenify very few of of them), the phone changes its state to idle too strictly and too perfectly and I want it to be. For example, my current doze records were like:
8:00 - turned off my phone
8:04 - 8:19: doze // 14 mins
8:19 - 8:20: awake // 20s
8:20 - 9:00: doze // 40 mins
9:00 - 9:01: doze // 1 mins.
9:01 - 13:00: doze / 4 hours.
etc...
If you have read my doze configs, you can see that my phone now nearly perfect as my settings, I set it to doze after 3 minutes, then after 15 mins wake up 15 secs, then doze for 45 minutes.... etc... without any big difference. The weird thing is that music apps still works perfectly for me. :angel:
Now with Zenfone 2, my phone only drains 3% through the night, with all wifi gps 3G on, and I can still receive notifications ! Zenfone 2 users please come and praise me lol
It's been a long time since I last visited xda so I don't know if anybody has tried this, it would be a shame if I'm sharing what everyone already knew, but if not I guess this post would be very useful for many people.
Cheers, for a better and more simpler Android world ! :silly:
Click to expand...
Click to collapse
Do you you Aggressive Doze and Disable Motion Sensing at all? Naptime has these settings and I'm not sure whether to put them on or not!

Play Sound at night

Hello Forum,
I have an Xiaomi Redmi Note 3 with Lineage Android 7.1.2. I have installed Firefox and USI extension for inserting JavaScripts. If something happens on a special website a script should play for 20 seconds a load sound [1]. Regardless if day or night.
Problem: The Sound is only played for a short time, its a 100 ms *dut* instead of a load 20 sec *duuuuut*
Additional settings:
1. I take Firefox out from the 'Settings->Battery Power Optimization', so it runs the whole night.
2. At night I use the 'Disturb only for important messages' Mode := DOFIM-Mode.
3. For 'Setttings->Notifications' I'll allow Firefox to disturb me.
Observations at day:
a) If the DOFIM-Mode is turned off and the screen is turned off since 20 minutes I get my 20 seconds beep.
b) If the DOFIM-Mode is turned manually on at daytime and the screen is on too, I also get my 20 seconds beep.
c) If the DOFIM-Mode is turned manually on at daytime and the screen is off since 20 minutes, its again the short 100 ms *dut*.
So I thing the battery optimization together with the DOFIM-Mode turns something off that I need to play a sound. What could it be?
I'm using a german rom, so I dont know the exact names of the menu points in english language, if something is unclear, please ask.
Thanks
Peter
[1] How the JavaScript make the sound:
Code:
window.AudioContext = window.AudioContext || window.webkitAudioContext;
var context = new AudioContext();
var o = context.createOscillator();
o.type = 'sine';
o.frequency.value = 261.63;
o.connect(context.destination);
// Play Sinus for 20 sec:
o.start(0);
setTimeout(function() { o.stop(0); }, 20000);

Categories

Resources