Merge "Add api to change charging state update delay"
This commit is contained in:
committed by
Android (Google) Code Review
commit
4e78dec0d8
@@ -16,6 +16,8 @@
|
||||
|
||||
package android.os;
|
||||
|
||||
import android.Manifest.permission;
|
||||
import android.annotation.RequiresPermission;
|
||||
import android.annotation.SystemApi;
|
||||
import android.annotation.SystemService;
|
||||
import android.content.Context;
|
||||
@@ -369,4 +371,26 @@ public class BatteryManager {
|
||||
throw e.rethrowFromSystemServer();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the delay for reporting battery state as charging after device is plugged in.
|
||||
* This allows machine-learning or heuristics to delay the reporting and the corresponding
|
||||
* broadcast, based on battery level, charging rate, and/or other parameters.
|
||||
*
|
||||
* @param delayMillis the delay in milliseconds, negative value to reset.
|
||||
*
|
||||
* @return True if the delay was set successfully.
|
||||
*
|
||||
* @see ACTION_CHARGING
|
||||
* @hide
|
||||
*/
|
||||
@RequiresPermission(permission.POWER_SAVER)
|
||||
@SystemApi
|
||||
public boolean setChargingStateUpdateDelayMillis(int delayMillis) {
|
||||
try {
|
||||
return mBatteryStats.setChargingStateUpdateDelayMillis(delayMillis);
|
||||
} catch (RemoteException e) {
|
||||
throw e.rethrowFromSystemServer();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14280,6 +14280,17 @@ public final class Settings {
|
||||
*/
|
||||
public static final String APPOP_HISTORY_PARAMETERS =
|
||||
"appop_history_parameters";
|
||||
|
||||
/**
|
||||
* Delay for sending ACTION_CHARGING after device is plugged in.
|
||||
* This is used as an override for constants defined in BatteryStatsImpl for
|
||||
* ease of experimentation.
|
||||
*
|
||||
* @see com.android.internal.os.BatteryStatsImpl.Constants.KEY_BATTERY_CHARGED_DELAY_MS
|
||||
* @hide
|
||||
*/
|
||||
public static final String BATTERY_CHARGING_STATE_UPDATE_DELAY =
|
||||
"battery_charging_state_update_delay";
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user