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