diff options
9 files changed, 101 insertions, 35 deletions
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java index fd88a05..da21eaf 100644 --- a/core/java/android/app/ActivityThread.java +++ b/core/java/android/app/ActivityThread.java @@ -4235,11 +4235,6 @@ public final class ActivityThread { configDiff = mConfiguration.updateFrom(config); config = applyCompatConfiguration(mCurDefaultDisplayDpi); - - final Theme systemTheme = getSystemContext().getTheme(); - if ((systemTheme.getChangingConfigurations() & configDiff) != 0) { - systemTheme.rebase(); - } } ArrayList<ComponentCallbacks2> callbacks = collectComponentCallbacks(false, config); diff --git a/core/java/android/app/AlertDialog.java b/core/java/android/app/AlertDialog.java index abe12dc..7824072 100644 --- a/core/java/android/app/AlertDialog.java +++ b/core/java/android/app/AlertDialog.java @@ -1082,7 +1082,8 @@ public class AlertDialog extends Dialog implements DialogInterface { * create and display the dialog. */ public AlertDialog create() { - final AlertDialog dialog = new AlertDialog(P.mContext); + // Context has already been wrapped with the appropriate theme. + final AlertDialog dialog = new AlertDialog(P.mContext, 0, false); P.apply(dialog.mAlert); dialog.setCancelable(P.mCancelable); if (P.mCancelable) { diff --git a/graphics/java/android/graphics/drawable/RippleDrawable.java b/graphics/java/android/graphics/drawable/RippleDrawable.java index bf069d3..32f6a89 100644 --- a/graphics/java/android/graphics/drawable/RippleDrawable.java +++ b/graphics/java/android/graphics/drawable/RippleDrawable.java @@ -786,12 +786,16 @@ public class RippleDrawable extends LayerDrawable { mMaskColorFilter = new PorterDuffColorFilter(0, PorterDuff.Mode.SRC_IN); } - // Draw the appropriate mask. + // Draw the appropriate mask anchored to (0,0). + final int left = bounds.left; + final int top = bounds.top; + mMaskCanvas.translate(-left, -top); if (maskType == MASK_EXPLICIT) { drawMask(mMaskCanvas); } else if (maskType == MASK_CONTENT) { drawContent(mMaskCanvas); } + mMaskCanvas.translate(left, top); } private int getMaskType() { diff --git a/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java b/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java index 30680ed..fa87270 100644 --- a/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java +++ b/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java @@ -2905,9 +2905,9 @@ class AppWidgetServiceImpl extends IAppWidgetService.Stub implements WidgetBacku } // Now that we've told the host, push out an update. sendUpdateIntentLocked(provider, appWidgetIds); - providersUpdated = true; } } + providersUpdated = true; } } } diff --git a/services/core/java/com/android/server/am/ActivityStack.java b/services/core/java/com/android/server/am/ActivityStack.java index a75cc48..6e34876 100644 --- a/services/core/java/com/android/server/am/ActivityStack.java +++ b/services/core/java/com/android/server/am/ActivityStack.java @@ -3740,7 +3740,12 @@ final class ActivityStack { if (DEBUG_TRANSITION) Slog.v(TAG_TRANSITION, "Prepare to back transition: task=" + taskId); boolean prevIsHome = false; - if (tr.isOverHomeStack()) { + + // If true, we should resume the home activity next if the task we are moving to the + // back is over the home stack. We force to false if the task we are moving to back + // is the home task and we don't want it resumed after moving to the back. + final boolean canGoHome = !tr.isHomeTask() && tr.isOverHomeStack(); + if (canGoHome) { final TaskRecord nextTask = getNextTask(tr); if (nextTask != null) { nextTask.setTaskToReturnTo(tr.getTaskToReturnTo()); @@ -3774,8 +3779,7 @@ final class ActivityStack { } final TaskRecord task = mResumedActivity != null ? mResumedActivity.task : null; - if (prevIsHome || task == tr && tr.isOverHomeStack() - || numTasks <= 1 && isOnHomeDisplay()) { + if (prevIsHome || (task == tr && canGoHome) || (numTasks <= 1 && isOnHomeDisplay())) { if (!mService.mBooting && !mService.mBooted) { // Not ready yet! return false; diff --git a/services/core/java/com/android/server/fingerprint/FingerprintService.java b/services/core/java/com/android/server/fingerprint/FingerprintService.java index c705fbf..2c9d82b 100644 --- a/services/core/java/com/android/server/fingerprint/FingerprintService.java +++ b/services/core/java/com/android/server/fingerprint/FingerprintService.java @@ -454,6 +454,18 @@ public class FingerprintService extends SystemService implements IBinder.DeathRe "Must have " + permission + " permission."); } + int getEffectiveUserId(int userId) { + UserManager um = UserManager.get(mContext); + if (um != null) { + final long callingIdentity = Binder.clearCallingIdentity(); + userId = um.getCredentialOwnerProfile(userId); + Binder.restoreCallingIdentity(callingIdentity); + } else { + Slog.e(TAG, "Unable to acquire UserManager"); + } + return userId; + } + boolean isCurrentUserOrProfile(int userId) { UserManager um = UserManager.get(mContext); @@ -686,11 +698,15 @@ public class FingerprintService extends SystemService implements IBinder.DeathRe } final byte [] cryptoClone = Arrays.copyOf(cryptoToken, cryptoToken.length); + // Group ID is arbitrarily set to parent profile user ID. It just represents + // the default fingerprints for the user. + final int effectiveGroupId = getEffectiveUserId(groupId); + final boolean restricted = isRestricted(); mHandler.post(new Runnable() { @Override public void run() { - startEnrollment(token, cryptoClone, groupId, receiver, flags, restricted); + startEnrollment(token, cryptoClone, effectiveGroupId, receiver, flags, restricted); } }); } @@ -724,11 +740,16 @@ public class FingerprintService extends SystemService implements IBinder.DeathRe Slog.w(TAG, "Calling not granted permission to use fingerprint"); return; } + + // Group ID is arbitrarily set to parent profile user ID. It just represents + // the default fingerprints for the user. + final int effectiveGroupId = getEffectiveUserId(groupId); + final boolean restricted = isRestricted(); mHandler.post(new Runnable() { @Override public void run() { - startAuthentication(token, opId, groupId, receiver, flags, restricted); + startAuthentication(token, opId, effectiveGroupId, receiver, flags, restricted); } }); } @@ -751,10 +772,14 @@ public class FingerprintService extends SystemService implements IBinder.DeathRe final IFingerprintServiceReceiver receiver) { checkPermission(MANAGE_FINGERPRINT); // TODO: Maybe have another permission final boolean restricted = isRestricted(); + + // Group ID is arbitrarily set to parent profile user ID. It just represents + // the default fingerprints for the user. + final int effectiveGroupId = getEffectiveUserId(groupId); mHandler.post(new Runnable() { @Override public void run() { - startRemove(token, fingerId, groupId, receiver, restricted); + startRemove(token, fingerId, effectiveGroupId, receiver, restricted); } }); @@ -771,10 +796,15 @@ public class FingerprintService extends SystemService implements IBinder.DeathRe @Override // Binder call public void rename(final int fingerId, final int groupId, final String name) { checkPermission(MANAGE_FINGERPRINT); + + // Group ID is arbitrarily set to parent profile user ID. It just represents + // the default fingerprints for the user. + final int effectiveGroupId = getEffectiveUserId(groupId); mHandler.post(new Runnable() { @Override public void run() { - mFingerprintUtils.renameFingerprintForUser(mContext, fingerId, groupId, name); + mFingerprintUtils.renameFingerprintForUser(mContext, fingerId, + effectiveGroupId, name); } }); } @@ -784,15 +814,19 @@ public class FingerprintService extends SystemService implements IBinder.DeathRe if (!canUseFingerprint(opPackageName)) { return Collections.emptyList(); } - return FingerprintService.this.getEnrolledFingerprints(userId); + int effectiveUserId = getEffectiveUserId(userId); + + return FingerprintService.this.getEnrolledFingerprints(effectiveUserId); } @Override // Binder call - public boolean hasEnrolledFingerprints(int groupId, String opPackageName) { + public boolean hasEnrolledFingerprints(int userId, String opPackageName) { if (!canUseFingerprint(opPackageName)) { return false; } - return FingerprintService.this.hasEnrolledFingerprints(groupId); + + int effectiveUserId = getEffectiveUserId(userId); + return FingerprintService.this.hasEnrolledFingerprints(effectiveUserId); } @Override // Binder call @@ -829,8 +863,7 @@ public class FingerprintService extends SystemService implements IBinder.DeathRe IFingerprintDaemon daemon = getFingerprintDaemon(); if (daemon != null) { try { - // TODO: if this is a managed profile, use the profile parent's directory for - // storage. + userId = getEffectiveUserId(userId); final File systemDir = Environment.getUserSystemDirectory(userId); final File fpDir = new File(systemDir, FP_DATA_DIR); if (!fpDir.exists()) { diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java index 014527b..eb02199 100644 --- a/services/java/com/android/server/SystemServer.java +++ b/services/java/com/android/server/SystemServer.java @@ -1024,12 +1024,6 @@ public final class SystemServer { w.getDefaultDisplay().getMetrics(metrics); context.getResources().updateConfiguration(config, metrics); - // The system context's theme may be configuration-dependent. - final Theme systemTheme = context.getTheme(); - if (systemTheme.getChangingConfigurations() != 0) { - systemTheme.rebase(); - } - try { // TODO: use boot phase mPowerManagerService.systemReady(mActivityManagerService.getAppOpsService()); diff --git a/telephony/java/android/telephony/ServiceState.java b/telephony/java/android/telephony/ServiceState.java index 303a492..80515cf 100644 --- a/telephony/java/android/telephony/ServiceState.java +++ b/telephony/java/android/telephony/ServiceState.java @@ -220,6 +220,8 @@ public class ServiceState implements Parcelable { private int mCdmaEriIconIndex; private int mCdmaEriIconMode; + private boolean mIsDataRoamingFromRegistration; + /** * get String description of roaming type * @hide @@ -297,6 +299,7 @@ public class ServiceState implements Parcelable { mCdmaEriIconIndex = s.mCdmaEriIconIndex; mCdmaEriIconMode = s.mCdmaEriIconMode; mIsEmergencyOnly = s.mIsEmergencyOnly; + mIsDataRoamingFromRegistration = s.mIsDataRoamingFromRegistration; } /** @@ -324,6 +327,7 @@ public class ServiceState implements Parcelable { mCdmaEriIconIndex = in.readInt(); mCdmaEriIconMode = in.readInt(); mIsEmergencyOnly = in.readInt() != 0; + mIsDataRoamingFromRegistration = in.readInt() != 0; } public void writeToParcel(Parcel out, int flags) { @@ -348,6 +352,7 @@ public class ServiceState implements Parcelable { out.writeInt(mCdmaEriIconIndex); out.writeInt(mCdmaEriIconMode); out.writeInt(mIsEmergencyOnly ? 1 : 0); + out.writeInt(mIsDataRoamingFromRegistration ? 1 : 0); } public int describeContents() { @@ -439,6 +444,26 @@ public class ServiceState implements Parcelable { } /** + * Set whether data network registration state is roaming + * + * This should only be set to the roaming value received + * once the data registration phase has completed. + * @hide + */ + public void setDataRoamingFromRegistration(boolean dataRoaming) { + mIsDataRoamingFromRegistration = dataRoaming; + } + + /** + * Get whether data network registration state is roaming + * @return true if registration indicates roaming, false otherwise + * @hide + */ + public boolean getDataRoamingFromRegistration() { + return mIsDataRoamingFromRegistration; + } + + /** * Get current data network roaming type * @return roaming type * @hide @@ -599,7 +624,8 @@ public class ServiceState implements Parcelable { + ((null == mDataOperatorNumeric) ? 0 : mDataOperatorNumeric.hashCode()) + mCdmaRoamingIndicator + mCdmaDefaultRoamingIndicator - + (mIsEmergencyOnly ? 1 : 0)); + + (mIsEmergencyOnly ? 1 : 0) + + (mIsDataRoamingFromRegistration ? 1 : 0)); } @Override @@ -635,7 +661,8 @@ public class ServiceState implements Parcelable { && equalsHandlesNulls(mCdmaRoamingIndicator, s.mCdmaRoamingIndicator) && equalsHandlesNulls(mCdmaDefaultRoamingIndicator, s.mCdmaDefaultRoamingIndicator) - && mIsEmergencyOnly == s.mIsEmergencyOnly); + && mIsEmergencyOnly == s.mIsEmergencyOnly + && mIsDataRoamingFromRegistration == s.mIsDataRoamingFromRegistration); } /** @@ -736,7 +763,8 @@ public class ServiceState implements Parcelable { + " " + mSystemId + " RoamInd=" + mCdmaRoamingIndicator + " DefRoamInd=" + mCdmaDefaultRoamingIndicator - + " EmergOnly=" + mIsEmergencyOnly); + + " EmergOnly=" + mIsEmergencyOnly + + " IsDataRoamingFromRegistration=" + mIsDataRoamingFromRegistration); } private void setNullState(int state) { @@ -762,6 +790,7 @@ public class ServiceState implements Parcelable { mCdmaEriIconIndex = -1; mCdmaEriIconMode = -1; mIsEmergencyOnly = false; + mIsDataRoamingFromRegistration = false; } public void setStateOutOfService() { @@ -934,6 +963,7 @@ public class ServiceState implements Parcelable { mCdmaRoamingIndicator = m.getInt("cdmaRoamingIndicator"); mCdmaDefaultRoamingIndicator = m.getInt("cdmaDefaultRoamingIndicator"); mIsEmergencyOnly = m.getBoolean("emergencyOnly"); + mIsDataRoamingFromRegistration = m.getBoolean("isDataRoamingFromRegistration"); } /** @@ -962,6 +992,7 @@ public class ServiceState implements Parcelable { m.putInt("cdmaRoamingIndicator", mCdmaRoamingIndicator); m.putInt("cdmaDefaultRoamingIndicator", mCdmaDefaultRoamingIndicator); m.putBoolean("emergencyOnly", Boolean.valueOf(mIsEmergencyOnly)); + m.putBoolean("isDataRoamingFromRegistration", Boolean.valueOf(mIsDataRoamingFromRegistration)); } /** @hide */ diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/DelegateManager.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/DelegateManager.java index 47258b6..baf2e2e 100644 --- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/DelegateManager.java +++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/DelegateManager.java @@ -97,13 +97,13 @@ public final class DelegateManager<T> { * @return the delegate or null if not found. */ @Nullable - public T getDelegate(long native_object) { + public synchronized T getDelegate(long native_object) { if (native_object > 0) { - T delegate = mDelegates.get(native_object); + T delegate = mDelegates.get(native_object); if (Debug.DEBUG) { if (delegate == null) { - System.out.println("Unknown " + mClass.getSimpleName() + " with int " + + System.err.println("Unknown " + mClass.getSimpleName() + " with int " + native_object); } } @@ -119,14 +119,18 @@ public final class DelegateManager<T> { * @param newDelegate the delegate to add * @return a unique native int to identify the delegate */ - public long addNewDelegate(T newDelegate) { + public synchronized long addNewDelegate(T newDelegate) { long native_object = ++mDelegateCounter; + mDelegates.put(native_object, newDelegate); assert !mJavaReferences.contains(newDelegate); mJavaReferences.add(newDelegate); if (Debug.DEBUG) { - System.out.println("New " + mClass.getSimpleName() + " with int " + native_object); + System.out.println( + "New " + mClass.getSimpleName() + " " + + "with int " + + native_object); } return native_object; @@ -136,7 +140,7 @@ public final class DelegateManager<T> { * Removes the main reference on the given delegate. * @param native_object the native integer representing the delegate. */ - public void removeJavaReferenceFor(long native_object) { + public synchronized void removeJavaReferenceFor(long native_object) { T delegate = getDelegate(native_object); if (Debug.DEBUG) { |