diff options
33 files changed, 296 insertions, 146 deletions
diff --git a/api/current.txt b/api/current.txt index 7d1ee38b5c1a..e4cc11a16bc6 100644 --- a/api/current.txt +++ b/api/current.txt @@ -37310,7 +37310,8 @@ package android.telephony { method public java.lang.String getDeviceSoftwareVersion(); method public java.lang.String getGroupIdLevel1(); method public java.lang.String getGroupIdLevel1(int); - method public java.lang.String getIccSimChallengeResponse(int, java.lang.String); + method public java.lang.String getIccAuthentication(int, int, java.lang.String); + method public java.lang.String getIccAuthentication(int, int, int, java.lang.String); method public java.lang.String getLine1AlphaTag(int); method public java.lang.String getLine1Number(); method public java.lang.String getLine1Number(int); @@ -37379,6 +37380,13 @@ package android.telephony { field public static final java.lang.String ACTION_CONFIGURE_VOICEMAIL = "android.telephony.action.CONFIGURE_VOICEMAIL"; field public static final java.lang.String ACTION_PHONE_STATE_CHANGED = "android.intent.action.PHONE_STATE"; field public static final java.lang.String ACTION_RESPOND_VIA_MESSAGE = "android.intent.action.RESPOND_VIA_MESSAGE"; + field public static final int APPTYPE_CSIM = 4; // 0x4 + field public static final int APPTYPE_ISIM = 5; // 0x5 + field public static final int APPTYPE_RUIM = 3; // 0x3 + field public static final int APPTYPE_SIM = 1; // 0x1 + field public static final int APPTYPE_USIM = 2; // 0x2 + field public static final int AUTHTYPE_EAP_AKA = 129; // 0x81 + field public static final int AUTHTYPE_EAP_SIM = 128; // 0x80 field public static final int CALL_STATE_IDLE = 0; // 0x0 field public static final int CALL_STATE_OFFHOOK = 2; // 0x2 field public static final int CALL_STATE_RINGING = 1; // 0x1 diff --git a/api/system-current.txt b/api/system-current.txt index ff5747a935cf..f63d2ac2d589 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -40005,7 +40005,8 @@ package android.telephony { method public java.lang.String getDeviceSoftwareVersion(); method public java.lang.String getGroupIdLevel1(); method public java.lang.String getGroupIdLevel1(int); - method public java.lang.String getIccSimChallengeResponse(int, java.lang.String); + method public java.lang.String getIccAuthentication(int, int, java.lang.String); + method public java.lang.String getIccAuthentication(int, int, int, java.lang.String); method public java.lang.String getLine1AlphaTag(int); method public java.lang.String getLine1Number(); method public java.lang.String getLine1Number(int); @@ -40095,6 +40096,13 @@ package android.telephony { field public static final java.lang.String ACTION_PHONE_STATE_CHANGED = "android.intent.action.PHONE_STATE"; field public static final java.lang.String ACTION_RESPOND_VIA_MESSAGE = "android.intent.action.RESPOND_VIA_MESSAGE"; field public static final java.lang.String ACTION_SHOW_VOICEMAIL_NOTIFICATION = "android.telephony.action.SHOW_VOICEMAIL_NOTIFICATION"; + field public static final int APPTYPE_CSIM = 4; // 0x4 + field public static final int APPTYPE_ISIM = 5; // 0x5 + field public static final int APPTYPE_RUIM = 3; // 0x3 + field public static final int APPTYPE_SIM = 1; // 0x1 + field public static final int APPTYPE_USIM = 2; // 0x2 + field public static final int AUTHTYPE_EAP_AKA = 129; // 0x81 + field public static final int AUTHTYPE_EAP_SIM = 128; // 0x80 field public static final int CALL_STATE_IDLE = 0; // 0x0 field public static final int CALL_STATE_OFFHOOK = 2; // 0x2 field public static final int CALL_STATE_RINGING = 1; // 0x1 diff --git a/api/test-current.txt b/api/test-current.txt index 5163e95a3581..d495d9f694ac 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -37382,7 +37382,8 @@ package android.telephony { method public java.lang.String getDeviceSoftwareVersion(); method public java.lang.String getGroupIdLevel1(); method public java.lang.String getGroupIdLevel1(int); - method public java.lang.String getIccSimChallengeResponse(int, java.lang.String); + method public java.lang.String getIccAuthentication(int, int, java.lang.String); + method public java.lang.String getIccAuthentication(int, int, int, java.lang.String); method public java.lang.String getLine1AlphaTag(int); method public java.lang.String getLine1Number(); method public java.lang.String getLine1Number(int); @@ -37451,6 +37452,13 @@ package android.telephony { field public static final java.lang.String ACTION_CONFIGURE_VOICEMAIL = "android.telephony.action.CONFIGURE_VOICEMAIL"; field public static final java.lang.String ACTION_PHONE_STATE_CHANGED = "android.intent.action.PHONE_STATE"; field public static final java.lang.String ACTION_RESPOND_VIA_MESSAGE = "android.intent.action.RESPOND_VIA_MESSAGE"; + field public static final int APPTYPE_CSIM = 4; // 0x4 + field public static final int APPTYPE_ISIM = 5; // 0x5 + field public static final int APPTYPE_RUIM = 3; // 0x3 + field public static final int APPTYPE_SIM = 1; // 0x1 + field public static final int APPTYPE_USIM = 2; // 0x2 + field public static final int AUTHTYPE_EAP_AKA = 129; // 0x81 + field public static final int AUTHTYPE_EAP_SIM = 128; // 0x80 field public static final int CALL_STATE_IDLE = 0; // 0x0 field public static final int CALL_STATE_OFFHOOK = 2; // 0x2 field public static final int CALL_STATE_RINGING = 1; // 0x1 diff --git a/core/java/android/app/BackStackRecord.java b/core/java/android/app/BackStackRecord.java index 3a51aff37921..1e2cc2662018 100644 --- a/core/java/android/app/BackStackRecord.java +++ b/core/java/android/app/BackStackRecord.java @@ -146,6 +146,10 @@ final class BackStackState implements Parcelable { op.removed.add(r); } } + bse.mEnterAnim = op.enterAnim; + bse.mExitAnim = op.exitAnim; + bse.mPopEnterAnim = op.popEnterAnim; + bse.mPopExitAnim = op.popExitAnim; bse.addOp(op); num++; } diff --git a/core/java/android/appwidget/AppWidgetHost.java b/core/java/android/appwidget/AppWidgetHost.java index 1af495365825..2d9f4a71b005 100644 --- a/core/java/android/appwidget/AppWidgetHost.java +++ b/core/java/android/appwidget/AppWidgetHost.java @@ -17,8 +17,7 @@ package android.appwidget; import java.lang.ref.WeakReference; -import java.util.ArrayList; -import java.util.HashMap; +import java.util.List; import android.annotation.NonNull; import android.annotation.Nullable; @@ -35,7 +34,9 @@ import android.os.Message; import android.os.Process; import android.os.RemoteException; import android.os.ServiceManager; +import android.os.SystemClock; import android.util.DisplayMetrics; +import android.util.SparseArray; import android.util.TypedValue; import android.widget.RemoteViews; import android.widget.RemoteViews.OnClickHandler; @@ -62,7 +63,7 @@ public class AppWidgetHost { private final Handler mHandler; private final int mHostId; private final Callbacks mCallbacks; - private final HashMap<Integer,AppWidgetHostView> mViews = new HashMap<>(); + private final SparseArray<AppWidgetHostView> mViews = new SparseArray<>(); private OnClickHandler mOnClickHandler; static class Callbacks extends IAppWidgetHost.Stub { @@ -164,7 +165,6 @@ public class AppWidgetHost { bindService(); } - private static void bindService() { synchronized (sServiceLock) { if (sService == null) { @@ -179,17 +179,25 @@ public class AppWidgetHost { * becomes visible, i.e. from onStart() in your Activity. */ public void startListening() { - int[] updatedIds; - ArrayList<RemoteViews> updatedViews = new ArrayList<RemoteViews>(); + final int[] idsToUpdate; + synchronized (mViews) { + int N = mViews.size(); + idsToUpdate = new int[N]; + for (int i = 0; i < N; i++) { + idsToUpdate[i] = mViews.keyAt(i); + } + } + List<RemoteViews> updatedViews; + int[] updatedIds = new int[idsToUpdate.length]; try { - updatedIds = sService.startListening(mCallbacks, mContextOpPackageName, mHostId, - updatedViews); + updatedViews = sService.startListening( + mCallbacks, mContextOpPackageName, mHostId, idsToUpdate, updatedIds).getList(); } catch (RemoteException e) { throw new RuntimeException("system server dead?", e); } - final int N = updatedIds.length; + int N = updatedViews.size(); for (int i = 0; i < N; i++) { updateAppWidgetView(updatedIds[i], updatedViews.get(i)); } @@ -206,10 +214,6 @@ public class AppWidgetHost { catch (RemoteException e) { throw new RuntimeException("system server dead?", e); } - - // This is here because keyguard needs it since it'll be switching users after this call. - // If it turns out other apps need to call this often, we should re-think how this works. - clearViews(); } /** @@ -418,7 +422,9 @@ public class AppWidgetHost { * Clear the list of Views that have been created by this AppWidgetHost. */ protected void clearViews() { - mViews.clear(); + synchronized (mViews) { + mViews.clear(); + } } } diff --git a/core/java/android/ddm/DdmHandleHello.java b/core/java/android/ddm/DdmHandleHello.java index 2dce4257da57..b2288fc4492d 100644 --- a/core/java/android/ddm/DdmHandleHello.java +++ b/core/java/android/ddm/DdmHandleHello.java @@ -136,12 +136,14 @@ public class DdmHandleHello extends ChunkHandler { } String vmFlags = "CheckJNI=" + (vmRuntime.isCheckJniEnabled() ? "true" : "false"); + boolean isNativeDebuggable = vmRuntime.isNativeDebuggable(); ByteBuffer out = ByteBuffer.allocate(28 + vmIdent.length() * 2 + appName.length() * 2 + instructionSetDescription.length() * 2 - + vmFlags.length() * 2); + + vmFlags.length() * 2 + + 1); out.order(ChunkHandler.CHUNK_ORDER); out.putInt(DdmServer.CLIENT_PROTOCOL_VERSION); out.putInt(android.os.Process.myPid()); @@ -154,6 +156,7 @@ public class DdmHandleHello extends ChunkHandler { putString(out, instructionSetDescription); out.putInt(vmFlags.length()); putString(out, vmFlags); + out.put((byte)(isNativeDebuggable ? 1 : 0)); Chunk reply = new Chunk(CHUNK_HELO, out); diff --git a/core/java/android/os/BatteryStats.java b/core/java/android/os/BatteryStats.java index 8e2dd6b85c00..c4528372987f 100644 --- a/core/java/android/os/BatteryStats.java +++ b/core/java/android/os/BatteryStats.java @@ -448,19 +448,41 @@ public abstract class BatteryStats implements Parcelable { public abstract Timer getForegroundActivityTimer(); public abstract Timer getBluetoothScanTimer(); - // Time this uid has any processes in the top state. + // Note: the following times are disjoint. They can be added together to find the + // total time a uid has had any processes running at all. + + /** + * Time this uid has any processes in the top state (or above such as persistent). + */ public static final int PROCESS_STATE_TOP = 0; - // Time this uid has any process with a started out bound foreground service. + /** + * Time this uid has any process with a started out bound foreground service, but + * none in the "top" state. + */ public static final int PROCESS_STATE_FOREGROUND_SERVICE = 1; - // Time this uid has any process that is top while the device is sleeping. + /** + * Time this uid has any process that is top while the device is sleeping, but none + * in the "foreground service" or better state. + */ public static final int PROCESS_STATE_TOP_SLEEPING = 2; - // Time this uid has any process in an active foreground state. + /** + * Time this uid has any process in an active foreground state, but none in the + * "top sleeping" or better state. + */ public static final int PROCESS_STATE_FOREGROUND = 3; - // Time this uid has any process in an active background state. + /** + * Time this uid has any process in an active background state, but none in the + * "foreground" or better state. + */ public static final int PROCESS_STATE_BACKGROUND = 4; - // Time this uid has any processes running at all. + /** + * Time this uid has any processes that are sitting around cached, not in one of the + * other active states. + */ public static final int PROCESS_STATE_CACHED = 5; - // Total number of process states we track. + /** + * Total number of process states we track. + */ public static final int NUM_PROCESS_STATE = 6; static final String[] PROCESS_STATE_NAMES = { diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index b723ffa83eca..b95d830ca9f2 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -16954,7 +16954,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, } } else if (cache != null) { mPrivateFlags &= ~PFLAG_DIRTY_MASK; - if (layerType == LAYER_TYPE_NONE) { + if (layerType == LAYER_TYPE_NONE || mLayerPaint == null) { // no layer paint, use temporary paint to draw bitmap Paint cachePaint = parent.mCachePaint; if (cachePaint == null) { @@ -16966,13 +16966,12 @@ public class View implements Drawable.Callback, KeyEvent.Callback, canvas.drawBitmap(cache, 0.0f, 0.0f, cachePaint); } else { // use layer paint to draw the bitmap, merging the two alphas, but also restore - int layerPaintAlpha = mLayerPaint != null ? mLayerPaint.getAlpha() : 255; - if (mLayerPaint == null && alpha < 1) { - mLayerPaint = new Paint(); + int layerPaintAlpha = mLayerPaint.getAlpha(); + if (alpha < 1) { mLayerPaint.setAlpha((int) (alpha * layerPaintAlpha)); } canvas.drawBitmap(cache, 0.0f, 0.0f, mLayerPaint); - if (mLayerPaint != null) { + if (alpha < 1) { mLayerPaint.setAlpha(layerPaintAlpha); } } diff --git a/core/java/android/view/inputmethod/InputMethodManager.java b/core/java/android/view/inputmethod/InputMethodManager.java index 687990124a55..4f4c6b99e582 100644 --- a/core/java/android/view/inputmethod/InputMethodManager.java +++ b/core/java/android/view/inputmethod/InputMethodManager.java @@ -1348,7 +1348,7 @@ public final class InputMethodManager { synchronized (mH) { if (DEBUG) Log.v(TAG, "onViewDetachedFromWindow: view=" + dumpViewInfo(view) + " mServedView=" + dumpViewInfo(mServedView)); - if (mServedView == view && view.hasWindowFocus()) { + if (mServedView == view) { mNextServedView = null; scheduleCheckFocusLocked(view); } diff --git a/core/java/com/android/internal/appwidget/IAppWidgetService.aidl b/core/java/com/android/internal/appwidget/IAppWidgetService.aidl index 5a195cb7dd20..4260e50a31f2 100644 --- a/core/java/com/android/internal/appwidget/IAppWidgetService.aidl +++ b/core/java/com/android/internal/appwidget/IAppWidgetService.aidl @@ -33,8 +33,8 @@ interface IAppWidgetService { // // for AppWidgetHost // - int[] startListening(IAppWidgetHost host, String callingPackage, int hostId, - out List<RemoteViews> updatedViews); + ParceledListSlice startListening(IAppWidgetHost host, String callingPackage, int hostId, + in int[] appWidgetIds, out int[] updatedIds); void stopListening(String callingPackage, int hostId); int allocateAppWidgetId(String callingPackage, int hostId); void deleteAppWidgetId(String callingPackage, int appWidgetId); diff --git a/data/fonts/Android.mk b/data/fonts/Android.mk index e3639ecdeeb8..f4c5b53dd36b 100644 --- a/data/fonts/Android.mk +++ b/data/fonts/Android.mk @@ -108,6 +108,6 @@ CHECK_EMOJI := true endif .PHONY: fontchain_lint -fontchain_lint: $(FONTCHAIN_LINTER) $(TARGET_OUT)/etc/fonts.xml +fontchain_lint: $(FONTCHAIN_LINTER) $(TARGET_OUT)/etc/fonts.xml $(PRODUCT_OUT)/system.img PYTHONPATH=$$PYTHONPATH:external/fonttools/Lib \ python $(FONTCHAIN_LINTER) $(TARGET_OUT) $(CHECK_EMOJI) external/unicode diff --git a/packages/PrintServiceRecommendationService/res/values/strings.xml b/packages/PrintServiceRecommendationService/res/values/strings.xml index 83d38000395a..07d0004fa09b 100644 --- a/packages/PrintServiceRecommendationService/res/values/strings.xml +++ b/packages/PrintServiceRecommendationService/res/values/strings.xml @@ -23,7 +23,7 @@ <string name="plugin_vendor_brother">Brother</string> <string name="plugin_vendor_canon">Canon</string> <string name="plugin_vendor_xerox">Xerox</string> - <string name="plugin_vendor_samsung">Samsung Electorics</string> + <string name="plugin_vendor_samsung">Samsung Electronics</string> <string name="plugin_vendor_epson">Epson</string> <string name="plugin_vendor_konika_minolta">Konika Minolta</string> <string name="plugin_vendor_fuji">Fuji</string> diff --git a/packages/PrintServiceRecommendationService/res/xml/vendorconfigs.xml b/packages/PrintServiceRecommendationService/res/xml/vendorconfigs.xml index fda2768c8678..119943cd5f9f 100644 --- a/packages/PrintServiceRecommendationService/res/xml/vendorconfigs.xml +++ b/packages/PrintServiceRecommendationService/res/xml/vendorconfigs.xml @@ -46,7 +46,7 @@ <vendor> <name>@string/plugin_vendor_canon</name> - <package>com.xerox.printservice</package> + <package>jp.co.canon.android.printservice.plugin</package> <mdns-names> <mdns-name>Canon</mdns-name> </mdns-names> @@ -54,7 +54,7 @@ <vendor> <name>@string/plugin_vendor_xerox</name> - <package>jp.co.canon.android.printservice.plugin</package> + <package>com.xerox.printservice</package> <mdns-names> <mdns-name>Xerox</mdns-name> </mdns-names> diff --git a/packages/SystemUI/src/com/android/systemui/ExpandHelper.java b/packages/SystemUI/src/com/android/systemui/ExpandHelper.java index aa3f6e5fe4a3..d12ab293ab3e 100644 --- a/packages/SystemUI/src/com/android/systemui/ExpandHelper.java +++ b/packages/SystemUI/src/com/android/systemui/ExpandHelper.java @@ -514,7 +514,7 @@ public class ExpandHelper implements Gefingerpoken { if (canBeExpanded) { if (DEBUG) Log.d(TAG, "working on an expandable child"); mNaturalHeight = mScaler.getNaturalHeight(); - mSmallSize = v.getMinExpandHeight(); + mSmallSize = v.getCollapsedHeight(); } else { if (DEBUG) Log.d(TAG, "working on a non-expandable child"); mNaturalHeight = mOldHeight; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java index 4ed64260dc7f..f5f5a92ca3b8 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java @@ -1843,11 +1843,12 @@ public abstract class BaseStatusBar extends SystemUI implements .getIdentifier(); if (mLockPatternUtils.isSeparateProfileChallengeEnabled(userId) && mKeyguardManager.isDeviceLocked(userId)) { - // Show work challenge, do not run pendingintent and - // remove notification - startWorkChallenge(userId, intent.getIntentSender(), - notificationKey); - return; + if (startWorkChallengeIfNecessary(userId, + intent.getIntentSender(), notificationKey)) { + // Show work challenge, do not run pendingintent and + // remove notification + return; + } } } try { @@ -1885,21 +1886,25 @@ public abstract class BaseStatusBar extends SystemUI implements }, afterKeyguardGone); } - public void startWorkChallenge(int userId, IntentSender intendSender, + public boolean startWorkChallengeIfNecessary(int userId, IntentSender intendSender, String notificationKey) { + final Intent newIntent = mKeyguardManager.createConfirmDeviceCredentialIntent(null, + null, userId); + if (newIntent == null) { + return false; + } final Intent callBackIntent = new Intent( WORK_CHALLENGE_UNLOCKED_NOTIFICATION_ACTION); callBackIntent.putExtra(Intent.EXTRA_INTENT, intendSender); callBackIntent.putExtra(Intent.EXTRA_INDEX, notificationKey); callBackIntent.setPackage(mContext.getPackageName()); - final Intent newIntent = mKeyguardManager.createConfirmDeviceCredentialIntent(null, - null, userId); newIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS | Intent.FLAG_ACTIVITY_CLEAR_TASK); newIntent.putExtra(Intent.EXTRA_INTENT, PendingIntent .getBroadcast(mContext, 0, callBackIntent, 0).getIntentSender()); mContext.startActivity(newIntent); + return true; } public void register(ExpandableNotificationRow row, StatusBarNotification sbn) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/DragDownHelper.java b/packages/SystemUI/src/com/android/systemui/statusbar/DragDownHelper.java index 7f87c3c687d8..2dabf5d32016 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/DragDownHelper.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/DragDownHelper.java @@ -170,22 +170,22 @@ public class DragDownHelper implements Gefingerpoken { : RUBBERBAND_FACTOR_STATIC; float rubberband = heightDelta * rubberbandFactor; if (expandable - && (rubberband + child.getMinExpandHeight()) > child.getMaxContentHeight()) { + && (rubberband + child.getCollapsedHeight()) > child.getMaxContentHeight()) { float overshoot = - (rubberband + child.getMinExpandHeight()) - child.getMaxContentHeight(); + (rubberband + child.getCollapsedHeight()) - child.getMaxContentHeight(); overshoot *= (1 - RUBBERBAND_FACTOR_STATIC); rubberband -= overshoot; } - child.setActualHeight((int) (child.getMinExpandHeight() + rubberband)); + child.setActualHeight((int) (child.getCollapsedHeight() + rubberband)); } private void cancelExpansion(final ExpandableView child) { - if (child.getActualHeight() == child.getMinExpandHeight()) { + if (child.getActualHeight() == child.getCollapsedHeight()) { mCallback.setUserLockedChild(child, false); return; } ObjectAnimator anim = ObjectAnimator.ofInt(child, "actualHeight", - child.getActualHeight(), child.getMinExpandHeight()); + child.getActualHeight(), child.getCollapsedHeight()); anim.setInterpolator(Interpolators.FAST_OUT_SLOW_IN); anim.setDuration(SPRING_BACK_ANIMATION_LENGTH_MS); anim.addListener(new AnimatorListenerAdapter() { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java index f9edeb312644..7ca7d12c590a 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java @@ -470,7 +470,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView { if(mExpandedWhenPinned) { return Math.max(getMaxExpandHeight(), mHeadsUpHeight); } else if (atLeastMinHeight) { - return Math.max(getMinHeight(), mHeadsUpHeight); + return Math.max(getCollapsedHeight(), mHeadsUpHeight); } else { return mHeadsUpHeight; } @@ -1040,12 +1040,12 @@ public class ExpandableNotificationRow extends ActivatableNotificationView { } else if (isExpanded()) { return Math.max(getMaxExpandHeight(), mHeadsUpHeight); } else { - return Math.max(getMinHeight(), mHeadsUpHeight); + return Math.max(getCollapsedHeight(), mHeadsUpHeight); } } else if (isExpanded()) { return getMaxExpandHeight(); } else { - return getMinHeight(); + return getCollapsedHeight(); } } @@ -1301,9 +1301,9 @@ public class ExpandableNotificationRow extends ActivatableNotificationView { } @Override - public int getMinExpandHeight() { + public int getCollapsedHeight() { if (mIsSummaryWithChildren && !mShowingPublic) { - return mChildrenContainer.getMinExpandHeight(); + return mChildrenContainer.getCollapsedHeight(); } return getMinHeight(); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableView.java b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableView.java index 91418ad312bf..6dcd61f259f3 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableView.java @@ -153,11 +153,11 @@ public abstract class ExpandableView extends FrameLayout { } /** - * @return The minimum height this child chan be expanded to. Note that this might be different - * than {@link #getMinHeight()} because some elements can't be collapsed by an expand gesture - * to it's absolute minimal height + * @return The collapsed height of this view. Note that this might be different + * than {@link #getMinHeight()} because some elements like groups may have different sizes when + * they are system expanded. */ - public int getMinExpandHeight() { + public int getCollapsedHeight() { return getHeight(); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java index f4fb0b925b07..5b005237e5d4 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java @@ -604,7 +604,7 @@ public class NotificationContentView extends FrameLayout { } int expandedVisualType = getVisualTypeForHeight(height); int collapsedVisualType = getVisualTypeForHeight( - mContainingNotification.getMinExpandHeight()); + mContainingNotification.getCollapsedHeight()); return mTransformationStartVisibleType == collapsedVisualType ? expandedVisualType : collapsedVisualType; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationChildrenContainer.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationChildrenContainer.java index dc567fc20113..2f4e799fd69b 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationChildrenContainer.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationChildrenContainer.java @@ -592,7 +592,7 @@ public class NotificationChildrenContainer extends ViewGroup { public float getGroupExpandFraction() { int visibleChildrenExpandedHeight = getVisibleChildrenExpandHeight(); - int minExpandHeight = getMinExpandHeight(); + int minExpandHeight = getCollapsedHeight(); float factor = (mActualHeight - minExpandHeight) / (float) (visibleChildrenExpandedHeight - minExpandHeight); return Math.max(0.0f, Math.min(1.0f, factor)); @@ -618,11 +618,14 @@ public class NotificationChildrenContainer extends ViewGroup { } public int getMinHeight() { - return getIntrinsicHeight(NUMBER_OF_CHILDREN_WHEN_COLLAPSED); + return getMinHeight(NUMBER_OF_CHILDREN_WHEN_COLLAPSED); } - public int getMinExpandHeight() { - int maxAllowedVisibleChildren = getMaxAllowedVisibleChildren(true /* forceCollapsed */); + public int getCollapsedHeight() { + return getMinHeight(getMaxAllowedVisibleChildren(true /* forceCollapsed */)); + } + + private int getMinHeight(int maxAllowedVisibleChildren) { int minExpandHeight = mNotificationHeaderHeight; int visibleChildren = 0; boolean firstChild = true; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java index 4a8abe68a091..bb1de046c291 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java @@ -1947,7 +1947,7 @@ public class NotificationStackScrollLayout extends ViewGroup public int getPeekHeight() { final ExpandableView firstChild = getFirstChildNotGone(); - final int firstChildMinHeight = firstChild != null ? (int) firstChild.getMinHeight() + final int firstChildMinHeight = firstChild != null ? firstChild.getCollapsedHeight() : mCollapsedSize; return mIntrinsicPadding + firstChildMinHeight + mBottomStackPeekSize + mBottomStackSlowDownHeight; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollAlgorithm.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollAlgorithm.java index 4c94fe93cbdc..c7333c2721b4 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollAlgorithm.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollAlgorithm.java @@ -368,7 +368,7 @@ public class StackScrollAlgorithm { childViewState.location = StackViewState.LOCATION_UNKNOWN; paddingAfterChild = getPaddingAfterChild(algorithmState, child); int childHeight = getMaxAllowedChildHeight(child); - int minHeight = child.getMinHeight(); + int collapsedHeight = child.getCollapsedHeight(); childViewState.yTranslation = currentYPosition; if (i == 0) { updateFirstChildHeight(child, childViewState, childHeight, ambientState); @@ -384,7 +384,7 @@ public class StackScrollAlgorithm { // According to the regular scroll view we are fully translated out of the // bottom of the screen so we are fully in the bottom stack updateStateForChildFullyInBottomStack(algorithmState, - bottomStackStart, childViewState, minHeight, ambientState, child); + bottomStackStart, childViewState, collapsedHeight, ambientState, child); } else { // According to the regular scroll view we are currently translating out of / // into the bottom of the screen @@ -475,17 +475,17 @@ public class StackScrollAlgorithm { float newTranslation = Math.max(ambientState.getTopPadding() + ambientState.getStackTranslation(), childState.yTranslation); childState.height = (int) Math.max(childState.height - (newTranslation - - childState.yTranslation), row.getMinHeight()); + - childState.yTranslation), row.getCollapsedHeight()); childState.yTranslation = newTranslation; } private void clampHunToMaxTranslation(AmbientState ambientState, ExpandableNotificationRow row, StackViewState childState) { float newTranslation; - float bottomPosition = ambientState.getMaxHeadsUpTranslation() - row.getMinHeight(); + float bottomPosition = ambientState.getMaxHeadsUpTranslation() - row.getCollapsedHeight(); newTranslation = Math.min(childState.yTranslation, bottomPosition); childState.height = (int) Math.max(childState.height - - (childState.yTranslation - newTranslation), row.getMinHeight()); + - (childState.yTranslation - newTranslation), row.getCollapsedHeight()); childState.yTranslation = newTranslation; } @@ -534,10 +534,10 @@ public class StackScrollAlgorithm { float offset = mBottomStackIndentationFunctor.getValue(algorithmState.partialInBottom); algorithmState.itemsInBottomStack += algorithmState.partialInBottom; int newHeight = childHeight; - if (childHeight > child.getMinHeight()) { + if (childHeight > child.getCollapsedHeight()) { newHeight = (int) Math.max(Math.min(transitioningPositionStart + offset - getPaddingAfterChild(algorithmState, child) - currentYPosition, childHeight), - child.getMinHeight()); + child.getCollapsedHeight()); childViewState.height = newHeight; } childViewState.yTranslation = transitioningPositionStart + offset - newHeight @@ -547,7 +547,7 @@ public class StackScrollAlgorithm { private void updateStateForChildFullyInBottomStack(StackScrollAlgorithmState algorithmState, float transitioningPositionStart, StackViewState childViewState, - int minHeight, AmbientState ambientState, ExpandableView child) { + int collapsedHeight, AmbientState ambientState, ExpandableView child) { float currentYPosition; algorithmState.itemsInBottomStack += 1.0f; if (algorithmState.itemsInBottomStack < MAX_ITEMS_IN_BOTTOM_STACK) { @@ -568,16 +568,14 @@ public class StackScrollAlgorithm { childViewState.location = StackViewState.LOCATION_BOTTOM_STACK_HIDDEN; currentYPosition = ambientState.getInnerHeight(); } - childViewState.height = minHeight; - childViewState.yTranslation = currentYPosition - minHeight; + childViewState.height = collapsedHeight; + childViewState.yTranslation = currentYPosition - collapsedHeight; } /** * Update the height of the first child i.e clamp it to the bottom stack * - * - * @param child the child to update * @param childViewState the viewstate of the child * @param childHeight the height of the child @@ -591,7 +589,7 @@ public class StackScrollAlgorithm { mBottomStackSlowDownLength + ambientState.getScrollY(); // Collapse and expand the first child while the shade is being expanded childViewState.height = (int) Math.max(Math.min(bottomPeekStart, (float) childHeight), - child.getMinHeight()); + child.getCollapsedHeight()); } /** diff --git a/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java b/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java index b6a99c8bdcf7..1b0d3acb1bad 100644 --- a/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java +++ b/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java @@ -744,8 +744,8 @@ class AppWidgetServiceImpl extends IAppWidgetService.Stub implements WidgetBacku } @Override - public int[] startListening(IAppWidgetHost callbacks, String callingPackage, - int hostId, List<RemoteViews> updatedViews) { + public ParceledListSlice<RemoteViews> startListening(IAppWidgetHost callbacks, + String callingPackage, int hostId, int[] appWidgetIds, int[] updatedIds) { final int userId = UserHandle.getCallingUserId(); if (DEBUG) { @@ -762,21 +762,21 @@ class AppWidgetServiceImpl extends IAppWidgetService.Stub implements WidgetBacku // sure the caller can only access hosts it owns. HostId id = new HostId(Binder.getCallingUid(), hostId, callingPackage); Host host = lookupOrAddHostLocked(id); - host.callbacks = callbacks; - updatedViews.clear(); - - ArrayList<Widget> instances = host.widgets; - int N = instances.size(); - int[] updatedIds = new int[N]; + int N = appWidgetIds.length; + ArrayList<RemoteViews> outViews = new ArrayList<>(N); + RemoteViews rv; + int added = 0; for (int i = 0; i < N; i++) { - Widget widget = instances.get(i); - updatedIds[i] = widget.appWidgetId; - updatedViews.add(cloneIfLocalBinder(widget.getEffectiveViewsLocked())); + rv = host.getPendingViewsForId(appWidgetIds[i]); + if (rv != null) { + updatedIds[added] = appWidgetIds[i]; + outViews.add(rv); + added++; + } } - - return updatedIds; + return new ParceledListSlice<>(outViews); } } @@ -1884,6 +1884,10 @@ class AppWidgetServiceImpl extends IAppWidgetService.Stub implements WidgetBacku } private void scheduleNotifyUpdateAppWidgetLocked(Widget widget, RemoteViews updateViews) { + long requestTime = SystemClock.uptimeMillis(); + if (widget != null) { + widget.lastUpdateTime = requestTime; + } if (widget == null || widget.provider == null || widget.provider.zombie || widget.host.callbacks == null || widget.host.zombie) { return; @@ -1893,6 +1897,7 @@ class AppWidgetServiceImpl extends IAppWidgetService.Stub implements WidgetBacku args.arg1 = widget.host; args.arg2 = widget.host.callbacks; args.arg3 = updateViews; + args.arg4 = requestTime; args.argi1 = widget.appWidgetId; mCallbackHandler.obtainMessage( @@ -1901,9 +1906,10 @@ class AppWidgetServiceImpl extends IAppWidgetService.Stub implements WidgetBacku } private void handleNotifyUpdateAppWidget(Host host, IAppWidgetHost callbacks, - int appWidgetId, RemoteViews views) { + int appWidgetId, RemoteViews views, long requestTime) { try { callbacks.updateAppWidget(appWidgetId, views); + host.lastWidgetUpdateTime = requestTime; } catch (RemoteException re) { synchronized (mLock) { Slog.e(TAG, "Widget host dead: " + host.id, re); @@ -3400,10 +3406,11 @@ class AppWidgetServiceImpl extends IAppWidgetService.Stub implements WidgetBacku Host host = (Host) args.arg1; IAppWidgetHost callbacks = (IAppWidgetHost) args.arg2; RemoteViews views = (RemoteViews) args.arg3; + long requestTime = (Long) args.arg4; final int appWidgetId = args.argi1; args.recycle(); - handleNotifyUpdateAppWidget(host, callbacks, appWidgetId, views); + handleNotifyUpdateAppWidget(host, callbacks, appWidgetId, views, requestTime); } break; case MSG_NOTIFY_PROVIDER_CHANGED: { @@ -3771,6 +3778,7 @@ class AppWidgetServiceImpl extends IAppWidgetService.Stub implements WidgetBacku boolean zombie; // if we're in safe mode, don't prune this just because nobody references it int tag = TAG_UNDEFINED; // for use while saving state (the index) + long lastWidgetUpdateTime; // last time we were successfully able to send an update. public int getUserId() { return UserHandle.getUserId(id.uid); @@ -3792,6 +3800,23 @@ class AppWidgetServiceImpl extends IAppWidgetService.Stub implements WidgetBacku return false; } + /** + * Returns the RemoveViews for the provided widget id if an update is pending + * for that widget. + */ + public RemoteViews getPendingViewsForId(int appWidgetId) { + long updateTime = lastWidgetUpdateTime; + int N = widgets.size(); + for (int i = 0; i < N; i++) { + Widget widget = widgets.get(i); + if (widget.appWidgetId == appWidgetId + && widget.lastUpdateTime > updateTime) { + return cloneIfLocalBinder(widget.getEffectiveViewsLocked()); + } + } + return null; + } + @Override public String toString() { return "Host{" + id + (zombie ? " Z" : "") + '}'; @@ -3862,6 +3887,7 @@ class AppWidgetServiceImpl extends IAppWidgetService.Stub implements WidgetBacku RemoteViews maskedViews; Bundle options; Host host; + long lastUpdateTime; @Override public String toString() { diff --git a/services/core/java/com/android/server/am/ActiveServices.java b/services/core/java/com/android/server/am/ActiveServices.java index d741c4948280..5d1cb8a08280 100755 --- a/services/core/java/com/android/server/am/ActiveServices.java +++ b/services/core/java/com/android/server/am/ActiveServices.java @@ -343,6 +343,25 @@ public final class ActiveServices { return null; } + if (!r.startRequested) { + final long token = Binder.clearCallingIdentity(); + try { + // Before going further -- if this app is not allowed to run in the + // background, then at this point we aren't going to let it period. + final int allowed = mAm.checkAllowBackgroundLocked( + r.appInfo.uid, r.packageName, callingPid, true); + if (allowed != ActivityManager.APP_START_MODE_NORMAL) { + Slog.w(TAG, "Background start not allowed: service " + + service + " to " + r.name.flattenToShortString() + + " from pid=" + callingPid + " uid=" + callingUid + + " pkg=" + callingPackage); + return null; + } + } finally { + Binder.restoreCallingIdentity(token); + } + } + NeededUriGrants neededGrants = mAm.checkGrantUriPermissionFromIntentLocked( callingUid, r.packageName, service, service.getFlags(), null, r.userId); @@ -1274,23 +1293,6 @@ public final class ActiveServices { } r = smap.mServicesByName.get(name); if (r == null && createIfNeeded) { - final long token = Binder.clearCallingIdentity(); - try { - // Before going further -- if this app is not allowed to run in the - // background, then at this point we aren't going to let it period. - final int allowed = mAm.checkAllowBackgroundLocked( - sInfo.applicationInfo.uid, sInfo.packageName, callingPid, true); - if (allowed != ActivityManager.APP_START_MODE_NORMAL) { - Slog.w(TAG, "Background execution not allowed: service " - + service + " to " + name.flattenToShortString() - + " from pid=" + callingPid + " uid=" + callingUid - + " pkg=" + callingPackage); - return null; - } - } finally { - Binder.restoreCallingIdentity(token); - } - Intent.FilterComparison filter = new Intent.FilterComparison(service.cloneFilter()); ServiceRestarter res = new ServiceRestarter(); diff --git a/services/core/java/com/android/server/am/ActivityStackSupervisor.java b/services/core/java/com/android/server/am/ActivityStackSupervisor.java index 6c09178cc2af..f659bde8d6d4 100644 --- a/services/core/java/com/android/server/am/ActivityStackSupervisor.java +++ b/services/core/java/com/android/server/am/ActivityStackSupervisor.java @@ -1984,6 +1984,8 @@ public final class ActivityStackSupervisor implements DisplayListener { mTmpConfigs.clear(); mTmpInsetBounds.clear(); final ArrayList<TaskRecord> tasks = stack.getAllTasks(); + final Rect taskBounds = tempTaskBounds != null ? tempTaskBounds : bounds; + final Rect insetBounds = tempTaskInsetBounds != null ? tempTaskInsetBounds : taskBounds; for (int i = tasks.size() - 1; i >= 0; i--) { final TaskRecord task = tasks.get(i); if (task.isResizeable()) { @@ -1995,9 +1997,7 @@ public final class ActivityStackSupervisor implements DisplayListener { fitWithinBounds(tempRect2, bounds); task.updateOverrideConfiguration(tempRect2); } else { - task.updateOverrideConfiguration( - tempTaskBounds != null ? tempTaskBounds : bounds, - tempTaskInsetBounds != null ? tempTaskInsetBounds : bounds); + task.updateOverrideConfiguration(taskBounds, insetBounds); } } diff --git a/services/core/java/com/android/server/pm/UserManagerService.java b/services/core/java/com/android/server/pm/UserManagerService.java index 90d500e53ab3..06a91fb0c857 100644 --- a/services/core/java/com/android/server/pm/UserManagerService.java +++ b/services/core/java/com/android/server/pm/UserManagerService.java @@ -500,6 +500,9 @@ public class UserManagerService extends IUserManager.Stub { if (mRemovingUserIds.get(profile.id)) { continue; } + if (profile.partial) { + continue; + } users.add(userWithName(profile)); } return users; diff --git a/services/core/java/com/android/server/wm/WindowLayersController.java b/services/core/java/com/android/server/wm/WindowLayersController.java index 3bfcf0088557..1d64c828c824 100644 --- a/services/core/java/com/android/server/wm/WindowLayersController.java +++ b/services/core/java/com/android/server/wm/WindowLayersController.java @@ -199,12 +199,6 @@ public class WindowLayersController { } layer = assignAndIncreaseLayerIfNeeded(mDockDivider, layer); - - // If we have a dock divider ensure the Input Method is above it. - if (mDockDivider != null && mService.mInputMethodWindow != null) { - layer = assignAndIncreaseLayerIfNeeded(mService.mInputMethodWindow, layer); - } - // We know that we will be animating a relaunching window in the near future, which will // receive a z-order increase. We want the replaced window to immediately receive the same // treatment, e.g. to be above the dock divider. diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java index fd6617a79bbd..e4630b47e79a 100644 --- a/services/core/java/com/android/server/wm/WindowManagerService.java +++ b/services/core/java/com/android/server/wm/WindowManagerService.java @@ -1373,7 +1373,7 @@ public class WindowManagerService extends IWindowManager.Stub // needs to sit above the dock divider, so it doesn't get cut in half. We make the dock // divider be a target for IME, so this relationship can occur naturally. if (fl == 0 || fl == (FLAG_NOT_FOCUSABLE|FLAG_ALT_FOCUSABLE_IM) - || type == TYPE_APPLICATION_STARTING) { + || type == TYPE_APPLICATION_STARTING || type == TYPE_DOCK_DIVIDER) { if (DEBUG_INPUT_METHOD) { Slog.i(TAG_WM, "isVisibleOrAdding " + w + ": " + w.isVisibleOrAdding()); if (!w.isVisibleOrAdding()) { @@ -4292,9 +4292,13 @@ public class WindowManagerService extends IWindowManager.Stub wtoken.appDied = false; wtoken.removeAllWindows(); } else if (visible) { - mOpeningApps.add(wtoken); + if (!mAppTransition.isTransitionSet() && mAppTransition.isReady()) { + // Add the app mOpeningApps if transition is unset but ready. This means + // we're doing a screen freeze, and the unfreeze will wait for all opening + // apps to be ready. + mOpeningApps.add(wtoken); + } wtoken.startingMoved = false; - // If the token is currently hidden (should be the common case), or has been // stopped, then we need to set up to wait for its windows to be ready. if (wtoken.hidden || wtoken.mAppStopped) { @@ -4338,6 +4342,7 @@ public class WindowManagerService extends IWindowManager.Stub } wtoken.inPendingTransaction = true; if (visible) { + mOpeningApps.add(wtoken); wtoken.mEnteringAnimation = true; } else { mClosingApps.add(wtoken); diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java index ec86a0190887..c62292dfeb86 100644 --- a/services/core/java/com/android/server/wm/WindowState.java +++ b/services/core/java/com/android/server/wm/WindowState.java @@ -807,26 +807,31 @@ final class WindowState implements WindowManagerPolicy.WindowState { mContentInsets.setEmpty(); mVisibleInsets.setEmpty(); } else { - // Using mContentInsets as a temp rect. It is safe because we're setting it below. - getDisplayContent().getLogicalDisplayRect(mContentInsets); + getDisplayContent().getLogicalDisplayRect(mTmpRect); // Override right and/or bottom insets in case if the frame doesn't fit the screen in // non-fullscreen mode. - boolean overrideRightInset = !fullscreenTask && mFrame.right > mContentInsets.right; - boolean overrideBottomInset = !fullscreenTask && mFrame.bottom > mContentInsets.bottom; + boolean overrideRightInset = !fullscreenTask && mFrame.right > mTmpRect.right; + boolean overrideBottomInset = !fullscreenTask && mFrame.bottom > mTmpRect.bottom; mContentInsets.set(mContentFrame.left - frame.left, mContentFrame.top - frame.top, - overrideRightInset ? 0 : frame.right - mContentFrame.right, - overrideBottomInset ? 0 : frame.bottom - mContentFrame.bottom); + overrideRightInset ? mTmpRect.right - mContentFrame.right + : frame.right - mContentFrame.right, + overrideBottomInset ? mTmpRect.bottom - mContentFrame.bottom + : frame.bottom - mContentFrame.bottom); mVisibleInsets.set(mVisibleFrame.left - frame.left, mVisibleFrame.top - frame.top, - overrideRightInset ? 0 : frame.right - mVisibleFrame.right, - overrideBottomInset ? 0 : frame.bottom - mVisibleFrame.bottom); + overrideRightInset ? mTmpRect.right - mVisibleFrame.right + : frame.right - mVisibleFrame.right, + overrideBottomInset ? mTmpRect.bottom - mVisibleFrame.bottom + : frame.bottom - mVisibleFrame.bottom); mStableInsets.set(Math.max(mStableFrame.left - frame.left, 0), Math.max(mStableFrame.top - frame.top, 0), - overrideRightInset ? 0 : Math.max(frame.right - mStableFrame.right, 0), - overrideBottomInset ? 0 : Math.max(frame.bottom - mStableFrame.bottom, 0)); + overrideRightInset ? Math.max(mTmpRect.right - mStableFrame.right, 0) + : Math.max(frame.right - mStableFrame.right, 0), + overrideBottomInset ? Math.max(mTmpRect.bottom - mStableFrame.bottom, 0) + : Math.max(frame.bottom - mStableFrame.bottom, 0)); } if (!mInsetFrame.isEmpty()) { diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java index 37f2302cbac3..0d4887d65cfe 100644 --- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java @@ -2805,6 +2805,10 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { && getActiveAdminUncheckedLocked(adminReceiver, userHandle) != null) { throw new IllegalArgumentException("Admin is already added"); } + if (policy.mRemovingAdmins.contains(adminReceiver)) { + throw new IllegalArgumentException( + "Trying to set an admin which is being removed"); + } ActiveAdmin newAdmin = new ActiveAdmin(info, /* parent */ false); policy.mAdminMap.put(adminReceiver, newAdmin); int replaceIndex = -1; @@ -3006,7 +3010,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { ArrayList<ActiveAdmin> admins = new ArrayList<ActiveAdmin>(); for (UserInfo userInfo : mUserManager.getProfiles(userHandle)) { DevicePolicyData policy = getUserData(userInfo.id); - if (!isManagedProfile(userInfo.id)) { + if (!userInfo.isManagedProfile()) { admins.addAll(policy.mAdminList); } else { // For managed profiles, we always include the policies set on the parent diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index b482811a18f2..865af7821ac2 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -3550,7 +3550,7 @@ public class TelephonyManager { * @return the response of ISIM Authetification, or null if not available * @hide * @deprecated - * @see getIccSimChallengeResponse with appType=PhoneConstants.APPTYPE_ISIM + * @see getIccAuthentication with appType=PhoneConstants.APPTYPE_ISIM */ public String getIsimChallengeResponse(String nonce){ try { @@ -3566,21 +3566,60 @@ public class TelephonyManager { } } + // ICC SIM Application Types + public static final int APPTYPE_SIM = PhoneConstants.APPTYPE_SIM; + public static final int APPTYPE_USIM = PhoneConstants.APPTYPE_USIM; + public static final int APPTYPE_RUIM = PhoneConstants.APPTYPE_RUIM; + public static final int APPTYPE_CSIM = PhoneConstants.APPTYPE_CSIM; + public static final int APPTYPE_ISIM = PhoneConstants.APPTYPE_ISIM; + // authContext (parameter P2) when doing SIM challenge, + // per 3GPP TS 31.102 (Section 7.1.2) + public static final int AUTHTYPE_EAP_SIM = PhoneConstants.AUTH_CONTEXT_EAP_SIM; + public static final int AUTHTYPE_EAP_AKA = PhoneConstants.AUTH_CONTEXT_EAP_AKA; + /** - * Returns the response of SIM Authentication through RIL. - * Returns null if the Authentication hasn't been successful - * @param subId subscription ID to be queried - * @param appType ICC application type (@see com.android.internal.telephony.PhoneConstants#APPTYPE_xxx) - * @param data authentication challenge data - * @return the response of SIM Authentication, or null if not available - * @hide + * Returns the response of authentication for the default subscription. + * Returns null if the authentication hasn't been successful + * + * <p>Requires that the calling app has carrier privileges or READ_PRIVILEGED_PHONE_STATE + * permission. + * + * @param appType the icc application type, like {@link #APPTYPE_USIM} + * @param authType the authentication type, {@link #AUTHTYPE_EAP_AKA} or + * {@link #AUTHTYPE_EAP_SIM} + * @param data authentication challenge data, base64 encoded. + * See 3GPP TS 31.102 7.1.2 for more details. + * @return the response of authentication, or null if not available + * + * @see #hasCarrierPrivileges */ - public String getIccSimChallengeResponse(int subId, int appType, String data) { + public String getIccAuthentication(int appType, int authType, String data) { + return getIccAuthentication(getDefaultSubscription(), appType, authType, data); + } + + /** + * Returns the response of USIM Authentication for specified subId. + * Returns null if the authentication hasn't been successful + * + * <p>Requires that the calling app has carrier privileges. + * + * @param subId subscription ID used for authentication + * @param appType the icc application type, like {@link #APPTYPE_USIM} + * @param authType the authentication type, {@link #AUTHTYPE_EAP_AKA} or + * {@link #AUTHTYPE_EAP_SIM} + * @param data authentication challenge data, base64 encoded. + * See 3GPP TS 31.102 7.1.2 for more details. + * @return the response of authentication, or null if not available + * + * @see #hasCarrierPrivileges + */ + + public String getIccAuthentication(int subId, int appType, int authType, String data) { try { IPhoneSubInfo info = getSubscriberInfo(); if (info == null) return null; - return info.getIccSimChallengeResponse(subId, appType, data); + return info.getIccSimChallengeResponse(subId, appType, authType, data); } catch (RemoteException ex) { return null; } catch (NullPointerException ex) { @@ -3599,9 +3638,10 @@ public class TelephonyManager { * @param appType ICC application type (@see com.android.internal.telephony.PhoneConstants#APPTYPE_xxx) * @param data authentication challenge data * @return the response of SIM Authentication, or null if not available + * @hide */ public String getIccSimChallengeResponse(int appType, String data) { - return getIccSimChallengeResponse(getDefaultSubscription(), appType, data); + return getIccAuthentication(getDefaultSubscription(), appType, AUTHTYPE_EAP_SIM, data); } /** diff --git a/telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl b/telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl index dc2b297f6dbe..02baa3454536 100644 --- a/telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl +++ b/telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl @@ -196,8 +196,9 @@ interface IPhoneSubInfo { * * @param subId subscription ID to be queried * @param appType ICC application type (@see com.android.internal.telephony.PhoneConstants#APPTYPE_xxx) + * @param authType Authentication type, see PhoneConstants#AUTHTYPE_xxx * @param data authentication challenge data * @return challenge response */ - String getIccSimChallengeResponse(int subId, int appType, String data); + String getIccSimChallengeResponse(int subId, int appType, int authType, String data); } diff --git a/telephony/java/com/android/internal/telephony/PhoneConstants.java b/telephony/java/com/android/internal/telephony/PhoneConstants.java index ecd89eda4577..1680fe33ead7 100644 --- a/telephony/java/com/android/internal/telephony/PhoneConstants.java +++ b/telephony/java/com/android/internal/telephony/PhoneConstants.java @@ -202,4 +202,10 @@ public class PhoneConstants { public static final int AUDIO_OUTPUT_ENABLE_SPEAKER = 0; public static final int AUDIO_OUTPUT_DISABLE_SPEAKER = 1; public static final int AUDIO_OUTPUT_DEFAULT = AUDIO_OUTPUT_ENABLE_SPEAKER; + + // authContext (parameter P2) when doing SIM challenge, + // per 3GPP TS 31.102 (Section 7.1.2) + public static final int AUTH_CONTEXT_EAP_SIM = 128; + public static final int AUTH_CONTEXT_EAP_AKA = 129; + public static final int AUTH_CONTEXT_UNDEFINED = -1; } |