diff options
Diffstat (limited to 'services')
24 files changed, 378 insertions, 85 deletions
diff --git a/services/accessibility/java/com/android/server/accessibility/ScreenMagnifier.java b/services/accessibility/java/com/android/server/accessibility/ScreenMagnifier.java index c8b080e..b4613d6 100644 --- a/services/accessibility/java/com/android/server/accessibility/ScreenMagnifier.java +++ b/services/accessibility/java/com/android/server/accessibility/ScreenMagnifier.java @@ -34,6 +34,7 @@ import android.provider.Settings; import android.text.TextUtils; import android.util.Property; import android.util.Slog; +import android.util.TypedValue; import android.view.GestureDetector; import android.view.GestureDetector.SimpleOnGestureListener; import android.view.MagnificationSpec; @@ -110,7 +111,6 @@ public final class ScreenMagnifier implements WindowManagerInternal.Magnificatio private static final int STATE_MAGNIFIED_INTERACTION = 4; private static final float DEFAULT_MAGNIFICATION_SCALE = 2.0f; - private static final int MULTI_TAP_TIME_SLOP_ADJUSTMENT = 50; private static final int MESSAGE_ON_MAGNIFIED_BOUNDS_CHANGED = 1; private static final int MESSAGE_ON_RECTANGLE_ON_SCREEN_REQUESTED = 2; @@ -135,9 +135,8 @@ public final class ScreenMagnifier implements WindowManagerInternal.Magnificatio private final AccessibilityManagerService mAms; - private final int mTapTimeSlop = ViewConfiguration.getTapTimeout(); - private final int mMultiTapTimeSlop = - ViewConfiguration.getDoubleTapTimeout() - MULTI_TAP_TIME_SLOP_ADJUSTMENT; + private final int mTapTimeSlop = ViewConfiguration.getJumpTapTimeout(); + private final int mMultiTapTimeSlop; private final int mTapDistanceSlop; private final int mMultiTapDistanceSlop; @@ -192,6 +191,9 @@ public final class ScreenMagnifier implements WindowManagerInternal.Magnificatio mWindowManager = LocalServices.getService(WindowManagerInternal.class); mAms = service; + mMultiTapTimeSlop = ViewConfiguration.getDoubleTapTimeout() + + mContext.getResources().getInteger( + com.android.internal.R.integer.config_screen_magnification_multi_tap_adjustment); mLongAnimationDuration = context.getResources().getInteger( com.android.internal.R.integer.config_longAnimTime); mTapDistanceSlop = ViewConfiguration.get(context).getScaledTouchSlop(); @@ -481,15 +483,20 @@ public final class ScreenMagnifier implements WindowManagerInternal.Magnificatio private static final float MIN_SCALE = 1.3f; private static final float MAX_SCALE = 5.0f; - private static final float SCALING_THRESHOLD = 0.3f; - private final ScaleGestureDetector mScaleGestureDetector; private final GestureDetector mGestureDetector; + private final float mScalingThreshold; + private float mInitialScaleFactor = -1; private boolean mScaling; public MagnifiedContentInteractonStateHandler(Context context) { + final TypedValue scaleValue = new TypedValue(); + context.getResources().getValue( + com.android.internal.R.dimen.config_screen_magnification_scaling_threshold, + scaleValue, false); + mScalingThreshold = scaleValue.getFloat(); mScaleGestureDetector = new ScaleGestureDetector(context, this); mScaleGestureDetector.setQuickScaleEnabled(false); mGestureDetector = new GestureDetector(context, this); @@ -537,7 +544,7 @@ public final class ScreenMagnifier implements WindowManagerInternal.Magnificatio mInitialScaleFactor = detector.getScaleFactor(); } else { final float deltaScale = detector.getScaleFactor() - mInitialScaleFactor; - if (Math.abs(deltaScale) > SCALING_THRESHOLD) { + if (Math.abs(deltaScale) > mScalingThreshold) { mScaling = true; return true; } diff --git a/services/core/java/com/android/server/PersistentDataBlockService.java b/services/core/java/com/android/server/PersistentDataBlockService.java index e5ace1b..97d16c0 100644 --- a/services/core/java/com/android/server/PersistentDataBlockService.java +++ b/services/core/java/com/android/server/PersistentDataBlockService.java @@ -110,8 +110,7 @@ public class PersistentDataBlockService extends SystemService { private void formatIfOemUnlockEnabled() { if (doGetOemUnlockEnabled()) { synchronized (mLock) { - formatPartitionLocked(); - doSetOemUnlockEnabledLocked(true); + formatPartitionLocked(true); } } } @@ -165,7 +164,7 @@ public class PersistentDataBlockService extends SystemService { byte[] digest = computeDigestLocked(storedDigest); if (digest == null || !Arrays.equals(storedDigest, digest)) { Slog.i(TAG, "Formatting FRP partition..."); - formatPartitionLocked(); + formatPartitionLocked(false); return false; } } @@ -242,7 +241,7 @@ public class PersistentDataBlockService extends SystemService { return md.digest(); } - private void formatPartitionLocked() { + private void formatPartitionLocked(boolean setOemUnlockEnabled) { DataOutputStream outputStream; try { outputStream = new DataOutputStream(new FileOutputStream(new File(mDataBlockFile))); @@ -264,7 +263,7 @@ public class PersistentDataBlockService extends SystemService { IoUtils.closeQuietly(outputStream); } - doSetOemUnlockEnabledLocked(false); + doSetOemUnlockEnabledLocked(setOemUnlockEnabled); computeAndWriteDigestLocked(); } diff --git a/services/core/java/com/android/server/TelephonyRegistry.java b/services/core/java/com/android/server/TelephonyRegistry.java index 8d7a182..4fbf23b 100644 --- a/services/core/java/com/android/server/TelephonyRegistry.java +++ b/services/core/java/com/android/server/TelephonyRegistry.java @@ -259,7 +259,7 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub { + newDefaultSubIdObj + " newDefaultPhoneId=" + newDefaultPhoneId); } - if(validatePhoneId(newDefaultPhoneId) && (newDefaultSubIdObj.equals(mDefaultSubId) + if(validatePhoneId(newDefaultPhoneId) && (!newDefaultSubIdObj.equals(mDefaultSubId) || (newDefaultPhoneId != mDefaultPhoneId))) { mHandler.sendMessage(mHandler.obtainMessage(MSG_UPDATE_DEFAULT_SUB, newDefaultPhoneId, 0, newDefaultSubIdObj)); diff --git a/services/core/java/com/android/server/UiModeManagerService.java b/services/core/java/com/android/server/UiModeManagerService.java index d1b4569..282f6a9 100644 --- a/services/core/java/com/android/server/UiModeManagerService.java +++ b/services/core/java/com/android/server/UiModeManagerService.java @@ -156,7 +156,7 @@ final class UiModeManagerService extends SystemService { @Override public void onStart() { final Context context = getContext(); - mTwilightManager = getLocalService(TwilightManager.class); + final PowerManager powerManager = (PowerManager) context.getSystemService(Context.POWER_SERVICE); mWakeLock = powerManager.newWakeLock(PowerManager.FULL_WAKE_LOCK, TAG); @@ -183,7 +183,11 @@ final class UiModeManagerService extends SystemService { mNightMode = Settings.Secure.getInt(context.getContentResolver(), Settings.Secure.UI_NIGHT_MODE, UiModeManager.MODE_NIGHT_AUTO); - mTwilightManager.registerListener(mTwilightListener, mHandler); + // Update the initial, static configurations. + synchronized (this) { + updateConfigurationLocked(); + sendConfigurationLocked(); + } publishBinderService(Context.UI_MODE_SERVICE, mService); } @@ -292,8 +296,11 @@ final class UiModeManagerService extends SystemService { pw.print(" mSetUiMode=0x"); pw.println(Integer.toHexString(mSetUiMode)); pw.print(" mHoldingConfiguration="); pw.print(mHoldingConfiguration); pw.print(" mSystemReady="); pw.println(mSystemReady); - pw.print(" mTwilightService.getCurrentState()="); - pw.println(mTwilightManager.getCurrentState()); + if (mTwilightManager != null) { + // We may not have a TwilightManager. + pw.print(" mTwilightService.getCurrentState()="); + pw.println(mTwilightManager.getCurrentState()); + } } } @@ -301,6 +308,10 @@ final class UiModeManagerService extends SystemService { public void onBootPhase(int phase) { if (phase == SystemService.PHASE_SYSTEM_SERVICES_READY) { synchronized (mLock) { + mTwilightManager = getLocalService(TwilightManager.class); + if (mTwilightManager != null) { + mTwilightManager.registerListener(mTwilightListener, mHandler); + } mSystemReady = true; mCarModeEnabled = mDockState == Intent.EXTRA_DOCK_STATE_CAR; updateComputedNightModeLocked(); @@ -626,9 +637,11 @@ final class UiModeManagerService extends SystemService { } private void updateComputedNightModeLocked() { - TwilightState state = mTwilightManager.getCurrentState(); - if (state != null) { - mComputedNightMode = state.isNight(); + if (mTwilightManager != null) { + TwilightState state = mTwilightManager.getCurrentState(); + if (state != null) { + mComputedNightMode = state.isNight(); + } } } diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java index 09ebe60..bdb0d6b 100644 --- a/services/core/java/com/android/server/am/ActivityManagerService.java +++ b/services/core/java/com/android/server/am/ActivityManagerService.java @@ -57,6 +57,7 @@ import android.util.ArrayMap; import android.util.ArraySet; import android.util.SparseIntArray; +import android.view.Display; import com.android.internal.R; import com.android.internal.annotations.GuardedBy; import com.android.internal.app.IAppOpsService; @@ -8720,14 +8721,13 @@ public final class ActivityManagerService extends ActivityManagerNative } @Override - public IActivityContainer getEnclosingActivityContainer(IBinder activityToken) - throws RemoteException { + public int getActivityDisplayId(IBinder activityToken) throws RemoteException { synchronized (this) { ActivityStack stack = ActivityRecord.getStackLocked(activityToken); - if (stack != null) { - return stack.mActivityContainer; + if (stack != null && stack.mActivityContainer.isAttachedLocked()) { + return stack.mActivityContainer.getDisplayId(); } - return null; + return Display.DEFAULT_DISPLAY; } } diff --git a/services/core/java/com/android/server/am/ActivityRecord.java b/services/core/java/com/android/server/am/ActivityRecord.java index 1497c1d..74d1ed7 100755 --- a/services/core/java/com/android/server/am/ActivityRecord.java +++ b/services/core/java/com/android/server/am/ActivityRecord.java @@ -474,10 +474,16 @@ final class ActivityRecord { AttributeCache.Entry ent = AttributeCache.instance().get(packageName, realTheme, com.android.internal.R.styleable.Window, userId); + final boolean translucent = ent.array.getBoolean( + com.android.internal.R.styleable.Window_windowIsTranslucent, false) + || (!ent.array.hasValue( + com.android.internal.R.styleable.Window_windowIsTranslucent) + && ent.array.getBoolean( + com.android.internal.R.styleable.Window_windowSwipeToDismiss, + false)); fullscreen = ent != null && !ent.array.getBoolean( com.android.internal.R.styleable.Window_windowIsFloating, false) - && !ent.array.getBoolean( - com.android.internal.R.styleable.Window_windowIsTranslucent, false); + && !translucent; noDisplay = ent != null && ent.array.getBoolean( com.android.internal.R.styleable.Window_windowNoDisplay, false); diff --git a/services/core/java/com/android/server/am/ActivityStackSupervisor.java b/services/core/java/com/android/server/am/ActivityStackSupervisor.java index 8ab2368..a2c8c71 100644 --- a/services/core/java/com/android/server/am/ActivityStackSupervisor.java +++ b/services/core/java/com/android/server/am/ActivityStackSupervisor.java @@ -69,6 +69,7 @@ import android.hardware.display.DisplayManagerGlobal; import android.hardware.display.VirtualDisplay; import android.hardware.input.InputManager; import android.hardware.input.InputManagerInternal; +import android.net.Uri; import android.os.Binder; import android.os.Bundle; import android.os.Debug; @@ -859,6 +860,11 @@ public final class ActivityStackSupervisor implements DisplayListener { ActivityContainer container = (ActivityContainer)iContainer; synchronized (mService) { + if (container != null && container.mParentActivity != null && + container.mParentActivity.state != ActivityState.RESUMED) { + // Cannot start a child activity if the parent is not resumed. + return ActivityManager.START_CANCELED; + } final int realCallingPid = Binder.getCallingPid(); final int realCallingUid = Binder.getCallingUid(); int callingPid; @@ -3793,18 +3799,21 @@ public final class ActivityStackSupervisor implements DisplayListener { @Override public final int startActivity(Intent intent) { mService.enforceNotIsolatedCaller("ActivityContainer.startActivity"); - int userId = mService.handleIncomingUser(Binder.getCallingPid(), + final int userId = mService.handleIncomingUser(Binder.getCallingPid(), Binder.getCallingUid(), mCurrentUser, false, ActivityManagerService.ALLOW_FULL_ONLY, "ActivityContainer", null); + // TODO: Switch to user app stacks here. - intent.addFlags(FORCE_NEW_TASK_FLAGS); String mimeType = intent.getType(); - if (mimeType == null && intent.getData() != null - && "content".equals(intent.getData().getScheme())) { - mimeType = mService.getProviderMimeType(intent.getData(), userId); + final Uri data = intent.getData(); + if (mimeType == null && data != null && "content".equals(data.getScheme())) { + mimeType = mService.getProviderMimeType(data, userId); } - return startActivityMayWait(null, -1, null, intent, mimeType, null, null, null, null, 0, - 0, null, null, null, null, userId, this, null); + checkEmbeddedAllowedInner(userId, intent, mimeType); + + intent.addFlags(FORCE_NEW_TASK_FLAGS); + return startActivityMayWait(null, -1, null, intent, mimeType, null, null, null, null, + 0, 0, null, null, null, null, userId, this, null); } @Override @@ -3815,21 +3824,19 @@ public final class ActivityStackSupervisor implements DisplayListener { throw new IllegalArgumentException("Bad PendingIntent object"); } - return ((PendingIntentRecord)intentSender).sendInner(0, null, null, null, null, null, - null, 0, FORCE_NEW_TASK_FLAGS, FORCE_NEW_TASK_FLAGS, null, this); - } - - private void checkEmbeddedAllowedInner(Intent intent, String resolvedType) { - int userId = mService.handleIncomingUser(Binder.getCallingPid(), + final int userId = mService.handleIncomingUser(Binder.getCallingPid(), Binder.getCallingUid(), mCurrentUser, false, ActivityManagerService.ALLOW_FULL_ONLY, "ActivityContainer", null); - if (resolvedType == null) { - resolvedType = intent.getType(); - if (resolvedType == null && intent.getData() != null - && "content".equals(intent.getData().getScheme())) { - resolvedType = mService.getProviderMimeType(intent.getData(), userId); - } - } + + final PendingIntentRecord pendingIntent = (PendingIntentRecord) intentSender; + checkEmbeddedAllowedInner(userId, pendingIntent.key.requestIntent, + pendingIntent.key.requestResolvedType); + + return pendingIntent.sendInner(0, null, null, null, null, null, null, 0, + FORCE_NEW_TASK_FLAGS, FORCE_NEW_TASK_FLAGS, null, this); + } + + private void checkEmbeddedAllowedInner(int userId, Intent intent, String resolvedType) { ActivityInfo aInfo = resolveActivity(intent, resolvedType, 0, null, userId); if (aInfo != null && (aInfo.flags & ActivityInfo.FLAG_ALLOW_EMBEDDED) == 0) { throw new SecurityException( @@ -3837,23 +3844,6 @@ public final class ActivityStackSupervisor implements DisplayListener { } } - /** Throw a SecurityException if allowEmbedded is not true */ - @Override - public final void checkEmbeddedAllowed(Intent intent) { - checkEmbeddedAllowedInner(intent, null); - } - - /** Throw a SecurityException if allowEmbedded is not true */ - @Override - public final void checkEmbeddedAllowedIntentSender(IIntentSender intentSender) { - if (!(intentSender instanceof PendingIntentRecord)) { - throw new IllegalArgumentException("Bad PendingIntent object"); - } - PendingIntentRecord pendingIntent = (PendingIntentRecord) intentSender; - checkEmbeddedAllowedInner(pendingIntent.key.requestIntent, - pendingIntent.key.requestResolvedType); - } - @Override public IBinder asBinder() { return this; diff --git a/services/core/java/com/android/server/am/PendingIntentRecord.java b/services/core/java/com/android/server/am/PendingIntentRecord.java index ffaa03d..7bdfced 100644 --- a/services/core/java/com/android/server/am/PendingIntentRecord.java +++ b/services/core/java/com/android/server/am/PendingIntentRecord.java @@ -29,6 +29,8 @@ import android.os.RemoteException; import android.os.UserHandle; import android.util.Slog; +import com.android.server.am.ActivityStackSupervisor.ActivityContainer; + import java.io.PrintWriter; import java.lang.ref.WeakReference; @@ -201,6 +203,13 @@ final class PendingIntentRecord extends IIntentSender.Stub { IBinder resultTo, String resultWho, int requestCode, int flagsMask, int flagsValues, Bundle options, IActivityContainer container) { synchronized(owner) { + final ActivityContainer activityContainer = (ActivityContainer)container; + if (activityContainer != null && activityContainer.mParentActivity != null && + activityContainer.mParentActivity.state + != ActivityStack.ActivityState.RESUMED) { + // Cannot start a child activity if the parent is not resumed. + return ActivityManager.START_CANCELED; + } if (!canceled) { sent = true; if ((key.flags&PendingIntent.FLAG_ONE_SHOT) != 0) { diff --git a/services/core/java/com/android/server/display/DisplayManagerService.java b/services/core/java/com/android/server/display/DisplayManagerService.java index 09dc477..5f0ad9f 100644 --- a/services/core/java/com/android/server/display/DisplayManagerService.java +++ b/services/core/java/com/android/server/display/DisplayManagerService.java @@ -46,7 +46,6 @@ import android.os.ServiceManager; import android.os.SystemClock; import android.os.SystemProperties; import android.text.TextUtils; -import android.util.Log; import android.util.Slog; import android.util.SparseArray; import android.view.Display; @@ -832,6 +831,24 @@ public final class DisplayManagerService extends SystemService { } } + private void setDisplayOffsetsInternal(int displayId, int x, int y) { + synchronized (mSyncRoot) { + LogicalDisplay display = mLogicalDisplays.get(displayId); + if (display == null) { + return; + } + if (display.getDisplayOffsetXLocked() != x + || display.getDisplayOffsetYLocked() != y) { + if (DEBUG) { + Slog.d(TAG, "Display " + displayId + " burn-in offset set to (" + + x + ", " + y + ")"); + } + display.setDisplayOffsetsLocked(x, y); + scheduleTraversalLocked(false); + } + } + } + private void clearViewportsLocked() { mDefaultViewport.valid = false; mExternalTouchViewport.valid = false; @@ -1513,5 +1530,10 @@ public final class DisplayManagerService extends SystemService { float requestedRefreshRate, boolean inTraversal) { setDisplayPropertiesInternal(displayId, hasContent, requestedRefreshRate, inTraversal); } + + @Override + public void setDisplayOffsets(int displayId, int x, int y) { + setDisplayOffsetsInternal(displayId, x, y); + } } } diff --git a/services/core/java/com/android/server/display/LogicalDisplay.java b/services/core/java/com/android/server/display/LogicalDisplay.java index 6c57eec..3bb7818 100644 --- a/services/core/java/com/android/server/display/LogicalDisplay.java +++ b/services/core/java/com/android/server/display/LogicalDisplay.java @@ -76,6 +76,10 @@ final class LogicalDisplay { // The pending requested refresh rate. 0 if no request is pending. private float mRequestedRefreshRate; + // The display offsets to apply to the display projection. + private int mDisplayOffsetX; + private int mDisplayOffsetY; + // Temporary rectangle used when needed. private final Rect mTempLayerStackRect = new Rect(); private final Rect mTempDisplayRect = new Rect(); @@ -313,6 +317,10 @@ final class LogicalDisplay { mTempDisplayRect.set(displayRectLeft, displayRectTop, displayRectLeft + displayRectWidth, displayRectTop + displayRectHeight); + mTempDisplayRect.left += mDisplayOffsetX; + mTempDisplayRect.right += mDisplayOffsetX; + mTempDisplayRect.top += mDisplayOffsetY; + mTempDisplayRect.bottom += mDisplayOffsetY; device.setProjectionInTransactionLocked(orientation, mTempLayerStackRect, mTempDisplayRect); } @@ -356,10 +364,34 @@ final class LogicalDisplay { return mRequestedRefreshRate; } + /** + * Gets the burn-in offset in X. + */ + public int getDisplayOffsetXLocked() { + return mDisplayOffsetX; + } + + /** + * Gets the burn-in offset in Y. + */ + public int getDisplayOffsetYLocked() { + return mDisplayOffsetY; + } + + /** + * Sets the burn-in offsets. + */ + public void setDisplayOffsetsLocked(int x, int y) { + mDisplayOffsetX = x; + mDisplayOffsetY = y; + } + public void dumpLocked(PrintWriter pw) { pw.println("mDisplayId=" + mDisplayId); pw.println("mLayerStack=" + mLayerStack); pw.println("mHasContent=" + mHasContent); + pw.println("mRequestedRefreshRate=" + mRequestedRefreshRate); + pw.println("mDisplayOffset=(" + mDisplayOffsetX + ", " + mDisplayOffsetY + ")"); pw.println("mPrimaryDisplayDevice=" + (mPrimaryDisplayDevice != null ? mPrimaryDisplayDevice.getNameLocked() : "null")); pw.println("mBaseDisplayInfo=" + mBaseDisplayInfo); diff --git a/services/core/java/com/android/server/hdmi/HdmiCecLocalDevicePlayback.java b/services/core/java/com/android/server/hdmi/HdmiCecLocalDevicePlayback.java index a8f6954..8034809 100644 --- a/services/core/java/com/android/server/hdmi/HdmiCecLocalDevicePlayback.java +++ b/services/core/java/com/android/server/hdmi/HdmiCecLocalDevicePlayback.java @@ -179,6 +179,13 @@ final class HdmiCecLocalDevicePlayback extends HdmiCecLocalDevice { } } + @ServiceThreadOnly + protected boolean handleUserControlPressed(HdmiCecMessage message) { + assertRunOnServiceThread(); + wakeUpIfActiveSource(); + return super.handleUserControlPressed(message); + } + @Override @ServiceThreadOnly protected boolean handleSetStreamPath(HdmiCecMessage message) { @@ -216,7 +223,12 @@ final class HdmiCecLocalDevicePlayback extends HdmiCecLocalDevice { } private void wakeUpIfActiveSource() { - if (mIsActiveSource && mService.isPowerStandbyOrTransient()) { + if (!mIsActiveSource) { + return; + } + // Wake up the device if the power is in standby mode, or its screen is off - + // which can happen if the device is holding a partial lock. + if (mService.isPowerStandbyOrTransient() || !mService.getPowerManager().isScreenOn()) { mService.wakeUp(); } } diff --git a/services/core/java/com/android/server/job/controllers/TimeController.java b/services/core/java/com/android/server/job/controllers/TimeController.java index 4c6cb17..b3d7287 100644 --- a/services/core/java/com/android/server/job/controllers/TimeController.java +++ b/services/core/java/com/android/server/job/controllers/TimeController.java @@ -91,14 +91,20 @@ public class TimeController extends StateController { public synchronized void maybeStartTrackingJob(JobStatus job) { if (job.hasTimingDelayConstraint() || job.hasDeadlineConstraint()) { maybeStopTrackingJob(job); + boolean isInsert = false; ListIterator<JobStatus> it = mTrackedJobs.listIterator(mTrackedJobs.size()); while (it.hasPrevious()) { JobStatus ts = it.previous(); if (ts.getLatestRunTimeElapsed() < job.getLatestRunTimeElapsed()) { // Insert + isInsert = true; break; } } + if(isInsert) + { + it.next(); + } it.add(job); maybeUpdateAlarms( job.hasTimingDelayConstraint() ? job.getEarliestRunTime() : Long.MAX_VALUE, diff --git a/services/core/java/com/android/server/media/MediaSessionService.java b/services/core/java/com/android/server/media/MediaSessionService.java index 77a1fa9..72e4b4b 100644 --- a/services/core/java/com/android/server/media/MediaSessionService.java +++ b/services/core/java/com/android/server/media/MediaSessionService.java @@ -56,6 +56,7 @@ import android.provider.Settings; import android.speech.RecognizerIntent; import android.text.TextUtils; import android.util.Log; +import android.util.Slog; import android.util.SparseArray; import android.view.KeyEvent; @@ -715,11 +716,19 @@ public class MediaSessionService extends SystemService implements Monitor { Log.w(TAG, "Attempted to dispatch null or non-media key event."); return; } + final int pid = Binder.getCallingPid(); final int uid = Binder.getCallingUid(); final long token = Binder.clearCallingIdentity(); - try { + if (!isUserSetupComplete()) { + // Global media key handling can have the side-effect of starting new + // activities which is undesirable while setup is in progress. + Slog.i(TAG, "Not dispatching media key event because user " + + "setup is in progress."); + return; + } + synchronized (mLock) { // If we don't have a media button receiver to fall back on // include non-playing sessions for dispatching @@ -1007,6 +1016,11 @@ public class MediaSessionService extends SystemService implements Monitor { return keyCode == KeyEvent.KEYCODE_HEADSETHOOK; } + private boolean isUserSetupComplete() { + return Settings.Secure.getIntForUser(getContext().getContentResolver(), + Settings.Secure.USER_SETUP_COMPLETE, 0, UserHandle.USER_CURRENT) != 0; + } + // we only handle public stream types, which are 0-5 private boolean isValidLocalStreamType(int streamType) { return streamType >= AudioManager.STREAM_VOICE_CALL diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java index bb8a785..dea4bed 100644 --- a/services/core/java/com/android/server/pm/PackageManagerService.java +++ b/services/core/java/com/android/server/pm/PackageManagerService.java @@ -274,6 +274,7 @@ public class PackageManagerService extends IPackageManager.Stub { static final int SCAN_TRUSTED_OVERLAY = 1<<9; static final int SCAN_DELETE_DATA_ON_FAILURES = 1<<10; static final int SCAN_REPLACING = 1<<11; + static final int SCAN_REQUIRE_KNOWN = 1<<12; static final int REMOVE_CHATTY = 1<<16; @@ -1645,10 +1646,10 @@ public class PackageManagerService extends IPackageManager.Stub { if (!mOnlyCore) { EventLog.writeEvent(EventLogTags.BOOT_PROGRESS_PMS_DATA_SCAN_START, SystemClock.uptimeMillis()); - scanDirLI(mAppInstallDir, 0, scanFlags, 0); + scanDirLI(mAppInstallDir, 0, scanFlags | SCAN_REQUIRE_KNOWN, 0); scanDirLI(mDrmAppPrivateInstallDir, PackageParser.PARSE_FORWARD_LOCK, - scanFlags, 0); + scanFlags | SCAN_REQUIRE_KNOWN, 0); /** * Remove disable package settings for any updated system @@ -5138,6 +5139,28 @@ public class PackageManagerService extends IPackageManager.Stub { + " already installed. Skipping duplicate."); } + // If we're only installing presumed-existing packages, require that the + // scanned APK is both already known and at the path previously established + // for it. Previously unknown packages we pick up normally, but if we have an + // a priori expectation about this package's install presence, enforce it. + if ((scanFlags & SCAN_REQUIRE_KNOWN) != 0) { + PackageSetting known = mSettings.peekPackageLPr(pkg.packageName); + if (known != null) { + if (DEBUG_PACKAGE_SCANNING) { + Log.d(TAG, "Examining " + pkg.codePath + + " and requiring known paths " + known.codePathString + + " & " + known.resourcePathString); + } + if (!pkg.applicationInfo.getCodePath().equals(known.codePathString) + || !pkg.applicationInfo.getResourcePath().equals(known.resourcePathString)) { + throw new PackageManagerException(INSTALL_FAILED_PACKAGE_CHANGED, + "Application package " + pkg.packageName + + " found at " + pkg.applicationInfo.getCodePath() + + " but expected at " + known.codePathString + "; ignoring."); + } + } + } + // Initialize package source and resource directories File destCodeFile = new File(pkg.applicationInfo.getCodePath()); File destResourceFile = new File(pkg.applicationInfo.getResourcePath()); diff --git a/services/core/java/com/android/server/power/Notifier.java b/services/core/java/com/android/server/power/Notifier.java index 1349926..c48367e 100644 --- a/services/core/java/com/android/server/power/Notifier.java +++ b/services/core/java/com/android/server/power/Notifier.java @@ -78,6 +78,7 @@ final class Notifier { private static final int MSG_USER_ACTIVITY = 1; private static final int MSG_BROADCAST = 2; private static final int MSG_WIRELESS_CHARGING_STARTED = 3; + private static final int MSG_SCREEN_BRIGHTNESS_BOOST_CHANGED = 4; private final Object mLock = new Object(); @@ -92,6 +93,7 @@ final class Notifier { private final NotifierHandler mHandler; private final Intent mScreenOnIntent; private final Intent mScreenOffIntent; + private final Intent mScreenBrightnessBoostIntent; // The current interactive state. private int mActualInteractiveState; @@ -128,6 +130,10 @@ final class Notifier { mScreenOffIntent = new Intent(Intent.ACTION_SCREEN_OFF); mScreenOffIntent.addFlags( Intent.FLAG_RECEIVER_REGISTERED_ONLY | Intent.FLAG_RECEIVER_FOREGROUND); + mScreenBrightnessBoostIntent = + new Intent(PowerManager.ACTION_SCREEN_BRIGHTNESS_BOOST_CHANGED); + mScreenBrightnessBoostIntent.addFlags( + Intent.FLAG_RECEIVER_REGISTERED_ONLY | Intent.FLAG_RECEIVER_FOREGROUND); // Initialize interactive state for battery stats. try { @@ -349,6 +355,19 @@ final class Notifier { } /** + * Called when screen brightness boost begins or ends. + */ + public void onScreenBrightnessBoostChanged() { + if (DEBUG) { + Slog.d(TAG, "onScreenBrightnessBoostChanged"); + } + + mSuspendBlocker.acquire(); + Message msg = mHandler.obtainMessage(MSG_SCREEN_BRIGHTNESS_BOOST_CHANGED); + msg.setAsynchronous(true); + mHandler.sendMessage(msg); + } + /** * Called when there has been user activity. */ public void onUserActivity(int event, int uid) { @@ -457,6 +476,22 @@ final class Notifier { } } + private void sendBrightnessBoostChangedBroadcast() { + if (DEBUG) { + Slog.d(TAG, "Sending brightness boost changed broadcast."); + } + + mContext.sendOrderedBroadcastAsUser(mScreenBrightnessBoostIntent, UserHandle.ALL, null, + mScreeBrightnessBoostChangedDone, mHandler, 0, null, null); + } + + private final BroadcastReceiver mScreeBrightnessBoostChangedDone = new BroadcastReceiver() { + @Override + public void onReceive(Context context, Intent intent) { + mSuspendBlocker.release(); + } + }; + private void sendWakeUpBroadcast() { if (DEBUG) { Slog.d(TAG, "Sending wake up broadcast."); @@ -539,6 +574,9 @@ final class Notifier { case MSG_WIRELESS_CHARGING_STARTED: playWirelessChargingStartedSound(); break; + case MSG_SCREEN_BRIGHTNESS_BOOST_CHANGED: + sendBrightnessBoostChangedBroadcast(); + break; } } } diff --git a/services/core/java/com/android/server/power/PowerManagerService.java b/services/core/java/com/android/server/power/PowerManagerService.java index 9786b42..9d6cc5e 100644 --- a/services/core/java/com/android/server/power/PowerManagerService.java +++ b/services/core/java/com/android/server/power/PowerManagerService.java @@ -128,6 +128,7 @@ public final class PowerManagerService extends SystemService private static final int WAKE_LOCK_PROXIMITY_SCREEN_OFF = 1 << 4; private static final int WAKE_LOCK_STAY_AWAKE = 1 << 5; // only set if already awake private static final int WAKE_LOCK_DOZE = 1 << 6; + private static final int WAKE_LOCK_DRAW = 1 << 7; // Summarizes the user activity state. private static final int USER_ACTIVITY_SCREEN_BRIGHT = 1 << 0; @@ -1079,6 +1080,9 @@ public final class PowerManagerService extends SystemService case PowerManager.GO_TO_SLEEP_REASON_POWER_BUTTON: Slog.i(TAG, "Going to sleep due to power button (uid " + uid +")..."); break; + case PowerManager.GO_TO_SLEEP_REASON_SLEEP_BUTTON: + Slog.i(TAG, "Going to sleep due to sleep button (uid " + uid +")..."); + break; case PowerManager.GO_TO_SLEEP_REASON_HDMI: Slog.i(TAG, "Going to sleep due to HDMI standby (uid " + uid +")..."); break; @@ -1398,12 +1402,15 @@ public final class PowerManagerService extends SystemService case PowerManager.DOZE_WAKE_LOCK: mWakeLockSummary |= WAKE_LOCK_DOZE; break; + case PowerManager.DRAW_WAKE_LOCK: + mWakeLockSummary |= WAKE_LOCK_DRAW; + break; } } // Cancel wake locks that make no sense based on the current state. if (mWakefulness != WAKEFULNESS_DOZING) { - mWakeLockSummary &= ~WAKE_LOCK_DOZE; + mWakeLockSummary &= ~(WAKE_LOCK_DOZE | WAKE_LOCK_DRAW); } if (mWakefulness == WAKEFULNESS_ASLEEP || (mWakeLockSummary & WAKE_LOCK_DOZE) != 0) { @@ -1422,6 +1429,9 @@ public final class PowerManagerService extends SystemService mWakeLockSummary |= WAKE_LOCK_CPU; } } + if ((mWakeLockSummary & WAKE_LOCK_DRAW) != 0) { + mWakeLockSummary |= WAKE_LOCK_CPU; + } if (DEBUG_SPEW) { Slog.d(TAG, "updateWakeLockSummaryLocked: mWakefulness=" @@ -1845,6 +1855,10 @@ public final class PowerManagerService extends SystemService if (mDisplayPowerRequest.policy == DisplayPowerRequest.POLICY_DOZE) { mDisplayPowerRequest.dozeScreenState = mDozeScreenStateOverrideFromDreamManager; + if (mDisplayPowerRequest.dozeScreenState == Display.STATE_DOZE_SUSPEND + && (mWakeLockSummary & WAKE_LOCK_DRAW) != 0) { + mDisplayPowerRequest.dozeScreenState = Display.STATE_DOZE; + } mDisplayPowerRequest.dozeScreenBrightness = mDozeScreenBrightnessOverrideFromDreamManager; } else { @@ -1886,6 +1900,7 @@ public final class PowerManagerService extends SystemService } } mScreenBrightnessBoostInProgress = false; + mNotifier.onScreenBrightnessBoostChanged(); userActivityNoUpdateLocked(now, PowerManager.USER_ACTIVITY_EVENT_OTHER, 0, Process.SYSTEM_UID); } @@ -2261,7 +2276,10 @@ public final class PowerManagerService extends SystemService Slog.i(TAG, "Brightness boost activated (uid " + uid +")..."); mLastScreenBrightnessBoostTime = eventTime; - mScreenBrightnessBoostInProgress = true; + if (!mScreenBrightnessBoostInProgress) { + mScreenBrightnessBoostInProgress = true; + mNotifier.onScreenBrightnessBoostChanged(); + } mDirty |= DIRTY_SCREEN_BRIGHTNESS_BOOST; userActivityNoUpdateLocked(eventTime, @@ -2270,6 +2288,12 @@ public final class PowerManagerService extends SystemService } } + private boolean isScreenBrightnessBoostedInternal() { + synchronized (mLock) { + return mScreenBrightnessBoostInProgress; + } + } + /** * Called when a screen brightness boost timeout has occurred. * @@ -2712,6 +2736,8 @@ public final class PowerManagerService extends SystemService return "PROXIMITY_SCREEN_OFF_WAKE_LOCK"; case PowerManager.DOZE_WAKE_LOCK: return "DOZE_WAKE_LOCK "; + case PowerManager.DRAW_WAKE_LOCK: + return "DRAW_WAKE_LOCK "; default: return "??? "; } @@ -3202,6 +3228,16 @@ public final class PowerManagerService extends SystemService } @Override // Binder call + public boolean isScreenBrightnessBoosted() { + final long ident = Binder.clearCallingIdentity(); + try { + return isScreenBrightnessBoostedInternal(); + } finally { + Binder.restoreCallingIdentity(ident); + } + } + + @Override // Binder call protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) { if (mContext.checkCallingOrSelfPermission(Manifest.permission.DUMP) != PackageManager.PERMISSION_GRANTED) { diff --git a/services/core/java/com/android/server/wm/CircularDisplayMask.java b/services/core/java/com/android/server/wm/CircularDisplayMask.java index 9fdfc47..7c2da2d 100644 --- a/services/core/java/com/android/server/wm/CircularDisplayMask.java +++ b/services/core/java/com/android/server/wm/CircularDisplayMask.java @@ -50,9 +50,10 @@ class CircularDisplayMask { private int mRotation; private boolean mVisible; private boolean mDimensionsUnequal = false; + private int mMaskThickness; public CircularDisplayMask(Display display, SurfaceSession session, int zOrder, - int screenOffset) { + int screenOffset, int maskThickness) { mScreenSize = new Point(); display.getSize(mScreenSize); if (mScreenSize.x != mScreenSize.y) { @@ -84,6 +85,7 @@ class CircularDisplayMask { mPaint.setAntiAlias(true); mPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR)); mScreenOffset = screenOffset; + mMaskThickness = maskThickness; } private void drawIfNeeded() { @@ -121,8 +123,8 @@ class CircularDisplayMask { int circleRadius = mScreenSize.x / 2; c.drawColor(Color.BLACK); - // The radius is reduced by 1 to provide an anti aliasing effect on the display edges. - c.drawCircle(circleRadius, circleRadius, circleRadius - 1, mPaint); + // The radius is reduced by mMaskThickness to provide an anti aliasing effect on the display edges. + c.drawCircle(circleRadius, circleRadius, circleRadius - mMaskThickness, mPaint); mSurface.unlockCanvasAndPost(c); } diff --git a/services/core/java/com/android/server/wm/EmulatorDisplayOverlay.java b/services/core/java/com/android/server/wm/EmulatorDisplayOverlay.java index 62f2b48..5e4bd8b 100644 --- a/services/core/java/com/android/server/wm/EmulatorDisplayOverlay.java +++ b/services/core/java/com/android/server/wm/EmulatorDisplayOverlay.java @@ -93,7 +93,9 @@ class EmulatorDisplayOverlay { } c.drawColor(Color.TRANSPARENT, PorterDuff.Mode.SRC); mSurfaceControl.setPosition(0, 0); - mOverlay.setBounds(0, 0, mScreenSize.x, mScreenSize.y); + // Always draw the overlay with square dimensions + int size = Math.max(mScreenSize.x, mScreenSize.y); + mOverlay.setBounds(0, 0, size, size); mOverlay.draw(c); mSurface.unlockCanvasAndPost(c); } diff --git a/services/core/java/com/android/server/wm/Session.java b/services/core/java/com/android/server/wm/Session.java index a4dfd8a..a1d145c 100644 --- a/services/core/java/com/android/server/wm/Session.java +++ b/services/core/java/com/android/server/wm/Session.java @@ -475,6 +475,16 @@ final class Session extends IWindowSession.Stub return mService.getWindowId(window); } + @Override + public void pokeDrawLock(IBinder window) { + final long identity = Binder.clearCallingIdentity(); + try { + mService.pokeDrawLock(this, window); + } finally { + Binder.restoreCallingIdentity(identity); + } + } + void windowAddedLocked() { if (mSurfaceSession == null) { if (WindowManagerService.localLOGV) Slog.v( diff --git a/services/core/java/com/android/server/wm/WindowAnimator.java b/services/core/java/com/android/server/wm/WindowAnimator.java index 64713d9..e833511 100644 --- a/services/core/java/com/android/server/wm/WindowAnimator.java +++ b/services/core/java/com/android/server/wm/WindowAnimator.java @@ -824,12 +824,16 @@ public class WindowAnimator { if (displayId < 0) { return 0; } - return mService.getDisplayContentLocked(displayId).pendingLayoutChanges; + DisplayContent displayContent = mService.getDisplayContentLocked(displayId); + return (displayContent != null) ? displayContent.pendingLayoutChanges : 0; } void setPendingLayoutChanges(final int displayId, final int changes) { if (displayId >= 0) { - mService.getDisplayContentLocked(displayId).pendingLayoutChanges |= changes; + DisplayContent displayContent = mService.getDisplayContentLocked(displayId); + if (displayContent != null) { + displayContent.pendingLayoutChanges |= changes; + } } } diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java index 8008064..f5a3c34 100644 --- a/services/core/java/com/android/server/wm/WindowManagerService.java +++ b/services/core/java/com/android/server/wm/WindowManagerService.java @@ -194,6 +194,7 @@ public class WindowManagerService extends IWindowManager.Stub static final boolean DEBUG_TASK_MOVEMENT = false; static final boolean DEBUG_STACK = false; static final boolean DEBUG_DISPLAY = false; + static final boolean DEBUG_POWER = false; static final boolean SHOW_SURFACE_ALLOC = false; static final boolean SHOW_TRANSACTIONS = false; static final boolean SHOW_LIGHT_TRANSACTIONS = false || SHOW_TRANSACTIONS; @@ -338,6 +339,7 @@ public class WindowManagerService extends IWindowManager.Stub final boolean mHaveInputMethods; final boolean mHasPermanentDpad; + final long mDrawLockTimeoutMillis; final boolean mAllowBootMessages; @@ -840,6 +842,8 @@ public class WindowManagerService extends IWindowManager.Stub com.android.internal.R.bool.config_hasPermanentDpad); mInTouchMode = context.getResources().getBoolean( com.android.internal.R.bool.config_defaultInTouchMode); + mDrawLockTimeoutMillis = context.getResources().getInteger( + com.android.internal.R.integer.config_drawLockTimeoutMillis); mInputManager = inputManager; // Must be before createDisplayContentLocked. mDisplayManagerInternal = LocalServices.getService(DisplayManagerInternal.class); mDisplaySettings = new DisplaySettings(); @@ -3005,6 +3009,15 @@ public class WindowManagerService extends IWindowManager.Stub } } + public void pokeDrawLock(Session session, IBinder token) { + synchronized (mWindowMap) { + WindowState window = windowForClientLocked(session, token, false); + if (window != null) { + window.pokeDrawLockLw(mDrawLockTimeoutMillis); + } + } + } + public int relayoutWindow(Session session, IWindow client, int seq, WindowManager.LayoutParams attrs, int requestedWidth, int requestedHeight, int viewVisibility, int flags, @@ -4388,8 +4401,13 @@ public class WindowManagerService extends IWindowManager.Stub + " ShowWallpaper=" + ent.array.getBoolean( com.android.internal.R.styleable.Window_windowShowWallpaper, false)); - if (ent.array.getBoolean( - com.android.internal.R.styleable.Window_windowIsTranslucent, false)) { + final boolean windowIsTranslucentDefined = ent.array.hasValue( + com.android.internal.R.styleable.Window_windowIsTranslucent); + final boolean windowIsTranslucent = ent.array.getBoolean( + com.android.internal.R.styleable.Window_windowIsTranslucent, false); + final boolean windowSwipeToDismiss = ent.array.getBoolean( + com.android.internal.R.styleable.Window_windowSwipeToDismiss, false); + if (windowIsTranslucent || (!windowIsTranslucentDefined && windowSwipeToDismiss)) { return; } if (ent.array.getBoolean( @@ -5992,13 +6010,15 @@ public class WindowManagerService extends IWindowManager.Stub if (mCircularDisplayMask == null) { int screenOffset = mContext.getResources().getDimensionPixelSize( com.android.internal.R.dimen.circular_display_mask_offset); + int maskThickness = mContext.getResources().getDimensionPixelSize( + com.android.internal.R.dimen.circular_display_mask_thickness); mCircularDisplayMask = new CircularDisplayMask( getDefaultDisplayContentLocked().getDisplay(), mFxSession, mPolicy.windowTypeToLayerLw( WindowManager.LayoutParams.TYPE_POINTER) - * TYPE_LAYER_MULTIPLIER + 10, screenOffset); + * TYPE_LAYER_MULTIPLIER + 10, screenOffset, maskThickness); } mCircularDisplayMask.setVisibility(true); } else if (mCircularDisplayMask != null) { @@ -10230,7 +10250,9 @@ public class WindowManagerService extends IWindowManager.Stub if (mAllowTheaterModeWakeFromLayout || Settings.Global.getInt(mContext.getContentResolver(), Settings.Global.THEATER_MODE_ON, 0) == 0) { - if (DEBUG_VISIBILITY) Slog.v(TAG, "Turning screen on after layout!"); + if (DEBUG_VISIBILITY || DEBUG_POWER) { + Slog.v(TAG, "Turning screen on after layout!"); + } mPowerManager.wakeUp(SystemClock.uptimeMillis()); } mTurnOnScreen = false; diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java index 938c1ce..d7b537f 100644 --- a/services/core/java/com/android/server/wm/WindowState.java +++ b/services/core/java/com/android/server/wm/WindowState.java @@ -19,9 +19,9 @@ package com.android.server.wm; import static com.android.server.wm.WindowManagerService.DEBUG_CONFIGURATION; import static com.android.server.wm.WindowManagerService.DEBUG_LAYOUT; import static com.android.server.wm.WindowManagerService.DEBUG_ORIENTATION; +import static com.android.server.wm.WindowManagerService.DEBUG_POWER; import static com.android.server.wm.WindowManagerService.DEBUG_RESIZE; import static com.android.server.wm.WindowManagerService.DEBUG_VISIBILITY; - import static android.view.WindowManager.LayoutParams.FIRST_SUB_WINDOW; import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_KEYGUARD; import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_COMPATIBLE_WINDOW; @@ -34,12 +34,15 @@ import static android.view.WindowManager.LayoutParams.TYPE_WALLPAPER; import android.app.AppOpsManager; import android.os.Debug; +import android.os.PowerManager; import android.os.RemoteCallbackList; import android.os.SystemClock; +import android.os.WorkSource; import android.util.TimeUtils; import android.view.Display; import android.view.IWindowFocusObserver; import android.view.IWindowId; + import com.android.server.input.InputWindowHandle; import android.content.Context; @@ -345,6 +348,15 @@ final class WindowState implements WindowManagerPolicy.WindowState { * the status bar */ boolean mUnderStatusBar = true; + /** + * Wake lock for drawing. + * Even though it's slightly more expensive to do so, we will use a separate wake lock + * for each app that is requesting to draw while dozing so that we can accurately track + * who is preventing the system from suspending. + * This lock is only acquired on first use. + */ + PowerManager.WakeLock mDrawLock; + WindowState(WindowManagerService service, Session s, IWindow c, WindowToken token, WindowState attachedWindow, int appOp, int seq, WindowManager.LayoutParams a, int viewVisibility, final DisplayContent displayContent) { @@ -1270,6 +1282,33 @@ final class WindowState implements WindowManagerPolicy.WindowState { } } + public void pokeDrawLockLw(long timeout) { + if (isVisibleOrAdding()) { + if (mDrawLock == null) { + // We want the tag name to be somewhat stable so that it is easier to correlate + // in wake lock statistics. So in particular, we don't want to include the + // window's hash code as in toString(). + CharSequence tag = mAttrs.getTitle(); + if (tag == null) { + tag = mAttrs.packageName; + } + mDrawLock = mService.mPowerManager.newWakeLock( + PowerManager.DRAW_WAKE_LOCK, "Window:" + tag); + mDrawLock.setReferenceCounted(false); + mDrawLock.setWorkSource(new WorkSource(mOwnerUid, mAttrs.packageName)); + } + // Each call to acquire resets the timeout. + if (DEBUG_POWER) { + Slog.d(TAG, "pokeDrawLock: poking draw lock on behalf of visible window owned by " + + mAttrs.packageName); + } + mDrawLock.acquire(timeout); + } else if (DEBUG_POWER) { + Slog.d(TAG, "pokeDrawLock: suppressed draw lock request for invisible window " + + "owned by " + mAttrs.packageName); + } + } + @Override public boolean isAlive() { return mClient.asBinder().isBinderAlive(); @@ -1629,6 +1668,9 @@ final class WindowState implements WindowManagerPolicy.WindowState { pw.print(" mWallpaperDisplayOffsetY="); pw.println(mWallpaperDisplayOffsetY); } + if (mDrawLock != null) { + pw.println("mDrawLock=" + mDrawLock); + } } String makeInputChannelName() { diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java index 40e2056..ec1258c 100644 --- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java @@ -3031,7 +3031,9 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { } PersistentDataBlockManager manager = (PersistentDataBlockManager) mContext.getSystemService(Context.PERSISTENT_DATA_BLOCK_SERVICE); - manager.wipe(); + if (manager != null) { + manager.wipe(); + } } boolean wipeExtRequested = (flags & WIPE_EXTERNAL_STORAGE) != 0; wipeDeviceOrUserLocked(wipeExtRequested, userHandle, diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java index 7871147..f984d4b 100644 --- a/services/java/com/android/server/SystemServer.java +++ b/services/java/com/android/server/SystemServer.java @@ -570,6 +570,10 @@ public final class SystemServer { } } + // We start this here so that we update our configuration to set watch or television + // as appropriate. + mSystemServiceManager.startService(UiModeManagerService.class); + try { mPackageManagerService.performBootDexOpt(); } catch (Throwable e) { @@ -835,8 +839,6 @@ public final class SystemServer { mSystemServiceManager.startService(TwilightService.class); - mSystemServiceManager.startService(UiModeManagerService.class); - mSystemServiceManager.startService(JobSchedulerService.class); if (!disableNonCoreServices) { |