am 32f7a6d8: Merge "Move device admin max screen off timeout to internal interface." into lmp-mr1-dev
automerge: c1275e7
* commit 'c1275e72eceb171544aaf517f0cb6e3d1cbd9e08':
Move device admin max screen off timeout to internal interface.
This commit is contained in:
@@ -49,7 +49,6 @@ interface IPowerManager
|
||||
void crash(String message);
|
||||
|
||||
void setStayOnSetting(int val);
|
||||
void setMaximumScreenOffTimeoutFromDeviceAdmin(int timeMs);
|
||||
void boostScreenBrightness(long time);
|
||||
|
||||
// temporarily overrides the screen brightness settings to allow the user to
|
||||
|
||||
@@ -55,6 +55,13 @@ public abstract class PowerManagerInternal {
|
||||
*/
|
||||
public abstract void setUserActivityTimeoutOverrideFromWindowManager(long timeoutMillis);
|
||||
|
||||
/**
|
||||
* Used by device administration to set the maximum screen off timeout.
|
||||
*
|
||||
* This method must only be called by the device administration policy manager.
|
||||
*/
|
||||
public abstract void setMaximumScreenOffTimeoutFromDeviceAdmin(int timeMs);
|
||||
|
||||
/**
|
||||
* Used by the dream manager to override certain properties while dozing.
|
||||
*
|
||||
|
||||
@@ -3140,21 +3140,6 @@ public final class PowerManagerService extends SystemService
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Used by device administration to set the maximum screen off timeout.
|
||||
*
|
||||
* This method must only be called by the device administration policy manager.
|
||||
*/
|
||||
@Override // Binder call
|
||||
public void setMaximumScreenOffTimeoutFromDeviceAdmin(int timeMs) {
|
||||
final long ident = Binder.clearCallingIdentity();
|
||||
try {
|
||||
setMaximumScreenOffTimeoutFromDeviceAdminInternal(timeMs);
|
||||
} finally {
|
||||
Binder.restoreCallingIdentity(ident);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Used by the settings application and brightness control widgets to
|
||||
* temporarily override the current screen brightness setting so that the
|
||||
@@ -3299,6 +3284,11 @@ public final class PowerManagerService extends SystemService
|
||||
setUserActivityTimeoutOverrideFromWindowManagerInternal(timeoutMillis);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMaximumScreenOffTimeoutFromDeviceAdmin(int timeMs) {
|
||||
setMaximumScreenOffTimeoutFromDeviceAdminInternal(timeMs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getLowPowerModeEnabled() {
|
||||
synchronized (mLock) {
|
||||
|
||||
@@ -59,9 +59,9 @@ import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.os.Handler;
|
||||
import android.os.IBinder;
|
||||
import android.os.IPowerManager;
|
||||
import android.os.PersistableBundle;
|
||||
import android.os.PowerManager;
|
||||
import android.os.PowerManagerInternal;
|
||||
import android.os.Process;
|
||||
import android.os.RecoverySystem;
|
||||
import android.os.RemoteCallback;
|
||||
@@ -204,7 +204,9 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
|
||||
|
||||
final LocalService mLocalService;
|
||||
|
||||
IPowerManager mIPowerManager;
|
||||
final PowerManager mPowerManager;
|
||||
final PowerManagerInternal mPowerManagerInternal;
|
||||
|
||||
IWindowManager mIWindowManager;
|
||||
NotificationManager mNotificationManager;
|
||||
|
||||
@@ -925,8 +927,9 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
|
||||
mUserManager = UserManager.get(mContext);
|
||||
mHasFeature = context.getPackageManager().hasSystemFeature(
|
||||
PackageManager.FEATURE_DEVICE_ADMIN);
|
||||
mWakeLock = ((PowerManager)context.getSystemService(Context.POWER_SERVICE))
|
||||
.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "DPM");
|
||||
mPowerManager = (PowerManager)context.getSystemService(Context.POWER_SERVICE);
|
||||
mPowerManagerInternal = LocalServices.getService(PowerManagerInternal.class);
|
||||
mWakeLock = mPowerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "DPM");
|
||||
mLocalService = new LocalService();
|
||||
if (!mHasFeature) {
|
||||
// Skip the rest of the initialization
|
||||
@@ -1038,14 +1041,6 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
|
||||
}
|
||||
}
|
||||
|
||||
private IPowerManager getIPowerManager() {
|
||||
if (mIPowerManager == null) {
|
||||
IBinder b = ServiceManager.getService(Context.POWER_SERVICE);
|
||||
mIPowerManager = IPowerManager.Stub.asInterface(b);
|
||||
}
|
||||
return mIPowerManager;
|
||||
}
|
||||
|
||||
private IWindowManager getWindowManager() {
|
||||
if (mIWindowManager == null) {
|
||||
IBinder b = ServiceManager.getService(Context.WINDOW_SERVICE);
|
||||
@@ -2729,12 +2724,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
|
||||
}
|
||||
|
||||
policy.mLastMaximumTimeToLock = timeMs;
|
||||
|
||||
try {
|
||||
getIPowerManager().setMaximumScreenOffTimeoutFromDeviceAdmin((int)timeMs);
|
||||
} catch (RemoteException e) {
|
||||
Slog.w(LOG_TAG, "Failure talking with power manager", e);
|
||||
}
|
||||
mPowerManagerInternal.setMaximumScreenOffTimeoutFromDeviceAdmin((int)timeMs);
|
||||
} finally {
|
||||
Binder.restoreCallingIdentity(ident);
|
||||
}
|
||||
@@ -2789,7 +2779,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
|
||||
long ident = Binder.clearCallingIdentity();
|
||||
try {
|
||||
// Power off the display
|
||||
getIPowerManager().goToSleep(SystemClock.uptimeMillis(),
|
||||
mPowerManager.goToSleep(SystemClock.uptimeMillis(),
|
||||
PowerManager.GO_TO_SLEEP_REASON_DEVICE_ADMIN, 0);
|
||||
// Ensure the device is locked
|
||||
new LockPatternUtils(mContext).requireCredentialEntry(UserHandle.USER_ALL);
|
||||
|
||||
@@ -115,11 +115,6 @@ public class BridgePowerManager implements IPowerManager {
|
||||
// pass for now.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMaximumScreenOffTimeoutFromDeviceAdmin(int arg0) throws RemoteException {
|
||||
// pass for now.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setStayOnSetting(int arg0) throws RemoteException {
|
||||
// pass for now.
|
||||
|
||||
Reference in New Issue
Block a user