diff options
40 files changed, 399 insertions, 277 deletions
diff --git a/api/current.txt b/api/current.txt index 96b96dbdaecd..6d9027a31eba 100644 --- a/api/current.txt +++ b/api/current.txt @@ -79,6 +79,7 @@ package android { field public static final java.lang.String INSTALL_LOCATION_PROVIDER = "android.permission.INSTALL_LOCATION_PROVIDER"; field public static final java.lang.String INSTALL_PACKAGES = "android.permission.INSTALL_PACKAGES"; field public static final java.lang.String INSTALL_SHORTCUT = "com.android.launcher.permission.INSTALL_SHORTCUT"; + field public static final java.lang.String INSTANT_APP_FOREGROUND_SERVICE = "android.permission.INSTANT_APP_FOREGROUND_SERVICE"; field public static final java.lang.String INTERNET = "android.permission.INTERNET"; field public static final java.lang.String KILL_BACKGROUND_PROCESSES = "android.permission.KILL_BACKGROUND_PROCESSES"; field public static final java.lang.String LOCATION_HARDWARE = "android.permission.LOCATION_HARDWARE"; diff --git a/api/system-current.txt b/api/system-current.txt index 3a58bf4c8d7a..7341424628f8 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -121,6 +121,7 @@ package android { field public static final java.lang.String INSTALL_LOCATION_PROVIDER = "android.permission.INSTALL_LOCATION_PROVIDER"; field public static final java.lang.String INSTALL_PACKAGES = "android.permission.INSTALL_PACKAGES"; field public static final java.lang.String INSTALL_SHORTCUT = "com.android.launcher.permission.INSTALL_SHORTCUT"; + field public static final java.lang.String INSTANT_APP_FOREGROUND_SERVICE = "android.permission.INSTANT_APP_FOREGROUND_SERVICE"; field public static final java.lang.String INTENT_FILTER_VERIFICATION_AGENT = "android.permission.INTENT_FILTER_VERIFICATION_AGENT"; field public static final java.lang.String INTERACT_ACROSS_USERS = "android.permission.INTERACT_ACROSS_USERS"; field public static final java.lang.String INTERACT_ACROSS_USERS_FULL = "android.permission.INTERACT_ACROSS_USERS_FULL"; diff --git a/api/test-current.txt b/api/test-current.txt index 36f5835188b3..4988ab3747a5 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -79,6 +79,7 @@ package android { field public static final java.lang.String INSTALL_LOCATION_PROVIDER = "android.permission.INSTALL_LOCATION_PROVIDER"; field public static final java.lang.String INSTALL_PACKAGES = "android.permission.INSTALL_PACKAGES"; field public static final java.lang.String INSTALL_SHORTCUT = "com.android.launcher.permission.INSTALL_SHORTCUT"; + field public static final java.lang.String INSTANT_APP_FOREGROUND_SERVICE = "android.permission.INSTANT_APP_FOREGROUND_SERVICE"; field public static final java.lang.String INTERNET = "android.permission.INTERNET"; field public static final java.lang.String KILL_BACKGROUND_PROCESSES = "android.permission.KILL_BACKGROUND_PROCESSES"; field public static final java.lang.String LOCATION_HARDWARE = "android.permission.LOCATION_HARDWARE"; diff --git a/core/java/android/app/AppOpsManager.java b/core/java/android/app/AppOpsManager.java index 603126b3badd..fb927e96d1f5 100644 --- a/core/java/android/app/AppOpsManager.java +++ b/core/java/android/app/AppOpsManager.java @@ -247,8 +247,10 @@ public class AppOpsManager { public static final int OP_REQUEST_INSTALL_PACKAGES = 66; /** @hide Enter picture-in-picture when hidden. */ public static final int OP_ENTER_PICTURE_IN_PICTURE_ON_HIDE = 67; + /** @hide Instant app start foreground service. */ + public static final int OP_INSTANT_APP_START_FOREGROUND = 68; /** @hide */ - public static final int _NUM_OP = 68; + public static final int _NUM_OP = 69; /** Access to coarse location information. */ public static final String OPSTR_COARSE_LOCATION = "android:coarse_location"; @@ -351,6 +353,9 @@ public class AppOpsManager { = "android:get_accounts"; public static final String OPSTR_READ_PHONE_NUMBER = "android:read_phone_number"; + /** @hide */ + public static final String OPSTR_INSTANT_APP_START_FOREGROUND + = "android:instant_app_start_foreground"; private static final int[] RUNTIME_PERMISSIONS_OPS = { // Contacts @@ -467,6 +472,7 @@ public class AppOpsManager { OP_READ_PHONE_NUMBER, OP_REQUEST_INSTALL_PACKAGES, OP_ENTER_PICTURE_IN_PICTURE_ON_HIDE, + OP_INSTANT_APP_START_FOREGROUND, }; /** @@ -542,6 +548,7 @@ public class AppOpsManager { OPSTR_READ_PHONE_NUMBER, null, // OP_REQUEST_INSTALL_PACKAGES null, + OPSTR_INSTANT_APP_START_FOREGROUND, }; /** @@ -617,6 +624,7 @@ public class AppOpsManager { "READ_PHONE_NUMBER", "REQUEST_INSTALL_PACKAGES", "OP_ENTER_PICTURE_IN_PICTURE_ON_HIDE", + "INSTANT_APP_START_FOREGROUND", }; /** @@ -692,6 +700,7 @@ public class AppOpsManager { Manifest.permission.READ_PHONE_NUMBER, Manifest.permission.REQUEST_INSTALL_PACKAGES, null, // no permission for entering picture-in-picture on hide + Manifest.permission.INSTANT_APP_FOREGROUND_SERVICE, }; /** @@ -768,6 +777,7 @@ public class AppOpsManager { null, // READ_PHONE_NUMBER null, // REQUEST_INSTALL_PACKAGES null, // ENTER_PICTURE_IN_PICTURE_ON_HIDE + null, // INSTANT_APP_START_FOREGROUND }; /** @@ -843,6 +853,7 @@ public class AppOpsManager { false, // READ_PHONE_NUMBER false, // REQUEST_INSTALL_PACKAGES false, // ENTER_PICTURE_IN_PICTURE_ON_HIDE + false, // INSTANT_APP_START_FOREGROUND }; /** @@ -917,6 +928,7 @@ public class AppOpsManager { AppOpsManager.MODE_ALLOWED, AppOpsManager.MODE_DEFAULT, // OP_REQUEST_INSTALL_PACKAGES AppOpsManager.MODE_ALLOWED, // OP_ENTER_PICTURE_IN_PICTURE_ON_HIDE + AppOpsManager.MODE_DEFAULT, // OP_INSTANT_APP_START_FOREGROUND }; /** @@ -995,6 +1007,7 @@ public class AppOpsManager { false, false, // OP_REQUEST_INSTALL_PACKAGES false, // OP_ENTER_PICTURE_IN_PICTURE_ON_HIDE + false, }; /** diff --git a/core/java/android/hardware/camera2/params/OutputConfiguration.java b/core/java/android/hardware/camera2/params/OutputConfiguration.java index d9512944d7ca..522575f09f4d 100644 --- a/core/java/android/hardware/camera2/params/OutputConfiguration.java +++ b/core/java/android/hardware/camera2/params/OutputConfiguration.java @@ -259,6 +259,10 @@ public final class OutputConfiguration implements Parcelable { throw new IllegalArgumentException("Unknow surface source class type"); } + if (surfaceSize.getWidth() == 0 || surfaceSize.getHeight() == 0) { + throw new IllegalArgumentException("Surface size needs to be non-zero"); + } + mSurfaceGroupId = SURFACE_GROUP_ID_NONE; mSurfaces = new ArrayList<Surface>(); mRotation = ROTATION_0; diff --git a/core/java/android/net/INetworkScoreService.aidl b/core/java/android/net/INetworkScoreService.aidl index 9cc256ec6510..f249daf87626 100644 --- a/core/java/android/net/INetworkScoreService.aidl +++ b/core/java/android/net/INetworkScoreService.aidl @@ -132,5 +132,14 @@ interface INetworkScoreService oneway void requestRecommendationAsync(in RecommendationRequest request, in RemoteCallback remoteCallback); + /** + * Returns metadata about the active scorer or <code>null</code> if there is no active scorer. + */ NetworkScorerAppManager.NetworkScorerAppData getActiveScorer(); + + /** + * Returns the list of available scorer apps. The list will be empty if there are + * no valid scorers. + */ + List<NetworkScorerAppManager.NetworkScorerAppData> getAllValidScorers(); } diff --git a/core/java/android/net/NetworkScoreManager.java b/core/java/android/net/NetworkScoreManager.java index 2875580971ae..8f3af6624996 100644 --- a/core/java/android/net/NetworkScoreManager.java +++ b/core/java/android/net/NetworkScoreManager.java @@ -37,6 +37,7 @@ import com.android.internal.util.Preconditions; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; +import java.util.List; import java.util.concurrent.CompletableFuture; /** @@ -200,6 +201,20 @@ public class NetworkScoreManager { } /** + * Returns the list of available scorer apps. The list will be empty if there are + * no valid scorers. + * + * @hide + */ + public List<NetworkScorerAppData> getAllValidScorers() { + try { + return mService.getAllValidScorers(); + } catch (RemoteException e) { + throw e.rethrowFromSystemServer(); + } + } + + /** * Update network scores. * * <p>This may be called at any time to re-score active networks. Scores will generally be diff --git a/core/java/android/net/NetworkScorerAppManager.java b/core/java/android/net/NetworkScorerAppManager.java index f3cbb52e500d..a166c7ffffe7 100644 --- a/core/java/android/net/NetworkScorerAppManager.java +++ b/core/java/android/net/NetworkScorerAppManager.java @@ -127,6 +127,14 @@ public class NetworkScorerAppManager { } /** + * Returns the list of available scorer apps. The list will be empty if there are + * no valid scorers. + */ + public List<NetworkScorerAppData> getAllValidScorers() { + return Collections.emptyList(); + } + + /** * @return A {@link NetworkScorerAppData} instance containing information about the * best configured network recommendation provider installed or {@code null} * if none of the configured packages can recommend networks. diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index 38f384fd6f07..8b8edac0199e 100755 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -6826,39 +6826,6 @@ public final class Settings { "system_navigation_keys_enabled"; /** - * Whether Downloads folder backup is enabled and should run on the device. - * - * @hide - */ - public static final String DOWNLOADS_BACKUP_ENABLED = "downloads_backup_enabled"; - - /** - * Whether Downloads folder backup should only occur if the device is using a metered - * network. - * - * @hide - */ - public static final String DOWNLOADS_BACKUP_ALLOW_METERED = - "downloads_backup_allow_metered"; - - /** - * Whether Downloads folder backup should only occur if the device is charging. - * - * @hide - */ - public static final String DOWNLOADS_BACKUP_CHARGING_ONLY = - "downloads_backup_charging_only"; - - /** - * How many days of information for the automatic storage manager to retain on the device - * for downloads. - * - * @hide - */ - public static final String AUTOMATIC_STORAGE_MANAGER_DOWNLOADS_DAYS_TO_RETAIN = - "automatic_storage_manager_downloads_days_to_retain"; - - /** * Holds comma separated list of ordering of QS tiles. * @hide */ diff --git a/core/java/android/view/GestureDetector.java b/core/java/android/view/GestureDetector.java index 27c1dcbe8ece..52e53b074165 100644 --- a/core/java/android/view/GestureDetector.java +++ b/core/java/android/view/GestureDetector.java @@ -502,6 +502,8 @@ public class GestureDetector { final boolean pointerUp = (action & MotionEvent.ACTION_MASK) == MotionEvent.ACTION_POINTER_UP; final int skipIndex = pointerUp ? ev.getActionIndex() : -1; + final boolean isGeneratedGesture = + (ev.getFlags() & MotionEvent.FLAG_IS_GENERATED_GESTURE) != 0; // Determine focal point float sumX = 0, sumY = 0; @@ -604,7 +606,8 @@ public class GestureDetector { final int deltaX = (int) (focusX - mDownFocusX); final int deltaY = (int) (focusY - mDownFocusY); int distance = (deltaX * deltaX) + (deltaY * deltaY); - if (distance > mTouchSlopSquare) { + int slopSquare = isGeneratedGesture ? 0 : mTouchSlopSquare; + if (distance > slopSquare) { handled = mListener.onScroll(mCurrentDownEvent, ev, scrollX, scrollY); mLastFocusX = focusX; mLastFocusY = focusY; @@ -613,7 +616,8 @@ public class GestureDetector { mHandler.removeMessages(SHOW_PRESS); mHandler.removeMessages(LONG_PRESS); } - if (distance > mDoubleTapTouchSlopSquare) { + int doubleTapSlopSquare = isGeneratedGesture ? 0 : mDoubleTapTouchSlopSquare; + if (distance > doubleTapSlopSquare) { mAlwaysInBiggerTapRegion = false; } } else if ((Math.abs(scrollX) >= 1) || (Math.abs(scrollY) >= 1)) { @@ -761,7 +765,10 @@ public class GestureDetector { int deltaX = (int) firstDown.getX() - (int) secondDown.getX(); int deltaY = (int) firstDown.getY() - (int) secondDown.getY(); - return (deltaX * deltaX + deltaY * deltaY < mDoubleTapSlopSquare); + final boolean isGeneratedGesture = + (firstDown.getFlags() & MotionEvent.FLAG_IS_GENERATED_GESTURE) != 0; + int slopSquare = isGeneratedGesture ? 0 : mDoubleTapSlopSquare; + return (deltaX * deltaX + deltaY * deltaY < slopSquare); } private void dispatchLongPress() { diff --git a/core/java/android/view/MotionEvent.java b/core/java/android/view/MotionEvent.java index 2316b3829f37..2129039b1b8c 100644 --- a/core/java/android/view/MotionEvent.java +++ b/core/java/android/view/MotionEvent.java @@ -186,7 +186,7 @@ public final class MotionEvent extends InputEvent implements Parcelable { * Bit mask of the parts of the action code that are the action itself. */ public static final int ACTION_MASK = 0xff; - + /** * Constant for {@link #getActionMasked}: A pressed gesture has started, the * motion contains the initial starting location. @@ -197,14 +197,14 @@ public final class MotionEvent extends InputEvent implements Parcelable { * </p> */ public static final int ACTION_DOWN = 0; - + /** * Constant for {@link #getActionMasked}: A pressed gesture has finished, the * motion contains the final release location as well as any intermediate * points since the last down or move event. */ public static final int ACTION_UP = 1; - + /** * Constant for {@link #getActionMasked}: A change has happened during a * press gesture (between {@link #ACTION_DOWN} and {@link #ACTION_UP}). @@ -212,14 +212,14 @@ public final class MotionEvent extends InputEvent implements Parcelable { * points since the last down or move event. */ public static final int ACTION_MOVE = 2; - + /** * Constant for {@link #getActionMasked}: The current gesture has been aborted. * You will not receive any more points in it. You should treat this as * an up event, but not perform any action that you normally would. */ public static final int ACTION_CANCEL = 3; - + /** * Constant for {@link #getActionMasked}: A movement has happened outside of the * normal bounds of the UI element. This does not provide a full gesture, @@ -237,7 +237,7 @@ public final class MotionEvent extends InputEvent implements Parcelable { * </p> */ public static final int ACTION_POINTER_DOWN = 5; - + /** * Constant for {@link #getActionMasked}: A non-primary pointer has gone up. * <p> @@ -343,7 +343,7 @@ public final class MotionEvent extends InputEvent implements Parcelable { * @see #getActionIndex */ public static final int ACTION_POINTER_INDEX_MASK = 0xff00; - + /** * Bit shift for the action bits holding the pointer index as * defined by {@link #ACTION_POINTER_INDEX_MASK}. @@ -358,56 +358,56 @@ public final class MotionEvent extends InputEvent implements Parcelable { */ @Deprecated public static final int ACTION_POINTER_1_DOWN = ACTION_POINTER_DOWN | 0x0000; - + /** * @deprecated Use {@link #ACTION_POINTER_INDEX_MASK} to retrieve the * data index associated with {@link #ACTION_POINTER_DOWN}. */ @Deprecated public static final int ACTION_POINTER_2_DOWN = ACTION_POINTER_DOWN | 0x0100; - + /** * @deprecated Use {@link #ACTION_POINTER_INDEX_MASK} to retrieve the * data index associated with {@link #ACTION_POINTER_DOWN}. */ @Deprecated public static final int ACTION_POINTER_3_DOWN = ACTION_POINTER_DOWN | 0x0200; - + /** * @deprecated Use {@link #ACTION_POINTER_INDEX_MASK} to retrieve the * data index associated with {@link #ACTION_POINTER_UP}. */ @Deprecated public static final int ACTION_POINTER_1_UP = ACTION_POINTER_UP | 0x0000; - + /** * @deprecated Use {@link #ACTION_POINTER_INDEX_MASK} to retrieve the * data index associated with {@link #ACTION_POINTER_UP}. */ @Deprecated public static final int ACTION_POINTER_2_UP = ACTION_POINTER_UP | 0x0100; - + /** * @deprecated Use {@link #ACTION_POINTER_INDEX_MASK} to retrieve the * data index associated with {@link #ACTION_POINTER_UP}. */ @Deprecated public static final int ACTION_POINTER_3_UP = ACTION_POINTER_UP | 0x0200; - + /** * @deprecated Renamed to {@link #ACTION_POINTER_INDEX_MASK} to match * the actual data contained in these bits. */ @Deprecated public static final int ACTION_POINTER_ID_MASK = 0xff00; - + /** * @deprecated Renamed to {@link #ACTION_POINTER_INDEX_SHIFT} to match * the actual data contained in these bits. */ @Deprecated public static final int ACTION_POINTER_ID_SHIFT = 8; - + /** * This flag indicates that the window that received this motion event is partly * or wholly obscured by another visible window above it. This flag is set to true @@ -444,6 +444,14 @@ public final class MotionEvent extends InputEvent implements Parcelable { public static final int FLAG_HOVER_EXIT_PENDING = 0x4; /** + * This flag indicates that the event has been generated by a gesture generator. It + * provides a hint to the GestureDector to not apply any touch slop. + * + * @hide + */ + public static final int FLAG_IS_GENERATED_GESTURE = 0x8; + + /** * Private flag that indicates when the system has detected that this motion event * may be inconsistent with respect to the sequence of previously delivered motion events, * such as when a pointer move event is sent but the pointer is not down. @@ -1582,9 +1590,9 @@ public final class MotionEvent extends InputEvent implements Parcelable { * Create a new MotionEvent, filling in all of the basic values that * define the motion. * - * @param downTime The time (in ms) when the user originally pressed down to start + * @param downTime The time (in ms) when the user originally pressed down to start * a stream of position events. This must be obtained from {@link SystemClock#uptimeMillis()}. - * @param eventTime The the time (in ms) when this specific event was generated. This + * @param eventTime The the time (in ms) when this specific event was generated. This * must be obtained from {@link SystemClock#uptimeMillis()}. * @param action The kind of action being performed, such as {@link #ACTION_DOWN}. * @param pointerCount The number of pointers that will be in this event. @@ -1623,7 +1631,7 @@ public final class MotionEvent extends InputEvent implements Parcelable { /** * Create a new MotionEvent, filling in all of the basic values that * define the motion. - * + * * @param downTime The time (in ms) when the user originally pressed down to start * a stream of position events. This must be obtained from {@link SystemClock#uptimeMillis()}. * @param eventTime The the time (in ms) when this specific event was generated. This @@ -1751,7 +1759,7 @@ public final class MotionEvent extends InputEvent implements Parcelable { * numbers are arbitrary and you shouldn't depend on the values. * @param edgeFlags A bitfield indicating which edges, if any, were touched by this * MotionEvent. - * + * * @deprecated Use {@link #obtain(long, long, int, float, float, float, float, int, float, float, int, int)} * instead. */ @@ -2057,7 +2065,7 @@ public final class MotionEvent extends InputEvent implements Parcelable { public final float getSize() { return nativeGetAxisValue(mNativePtr, AXIS_SIZE, 0, HISTORY_CURRENT); } - + /** * {@link #getTouchMajor(int)} for the first pointer index (may be an * arbitrary pointer identifier). @@ -2077,7 +2085,7 @@ public final class MotionEvent extends InputEvent implements Parcelable { public final float getTouchMinor() { return nativeGetAxisValue(mNativePtr, AXIS_TOUCH_MINOR, 0, HISTORY_CURRENT); } - + /** * {@link #getToolMajor(int)} for the first pointer index (may be an * arbitrary pointer identifier). @@ -2161,7 +2169,7 @@ public final class MotionEvent extends InputEvent implements Parcelable { /** * Given a pointer identifier, find the index of its data in the event. - * + * * @param pointerId The identifier of the pointer to be found. * @return Returns either the index of the pointer (for use with * {@link #getX(int)} et al.), or -1 if there is no data available for @@ -2175,8 +2183,8 @@ public final class MotionEvent extends InputEvent implements Parcelable { * Returns the X coordinate of this event for the given pointer * <em>index</em> (use {@link #getPointerId(int)} to find the pointer * identifier for this index). - * Whole numbers are pixels; the - * value may have a fraction for input devices that are sub-pixel precise. + * Whole numbers are pixels; the + * value may have a fraction for input devices that are sub-pixel precise. * @param pointerIndex Raw index of pointer to retrieve. Value may be from 0 * (the first pointer that is down) to {@link #getPointerCount()}-1. * @@ -2235,7 +2243,7 @@ public final class MotionEvent extends InputEvent implements Parcelable { public final float getSize(int pointerIndex) { return nativeGetAxisValue(mNativePtr, AXIS_SIZE, pointerIndex, HISTORY_CURRENT); } - + /** * Returns the length of the major axis of an ellipse that describes the touch * area at the point of contact for the given pointer @@ -2249,7 +2257,7 @@ public final class MotionEvent extends InputEvent implements Parcelable { public final float getTouchMajor(int pointerIndex) { return nativeGetAxisValue(mNativePtr, AXIS_TOUCH_MAJOR, pointerIndex, HISTORY_CURRENT); } - + /** * Returns the length of the minor axis of an ellipse that describes the touch * area at the point of contact for the given pointer @@ -2263,7 +2271,7 @@ public final class MotionEvent extends InputEvent implements Parcelable { public final float getTouchMinor(int pointerIndex) { return nativeGetAxisValue(mNativePtr, AXIS_TOUCH_MINOR, pointerIndex, HISTORY_CURRENT); } - + /** * Returns the length of the major axis of an ellipse that describes the size of * the approaching tool for the given pointer @@ -2279,7 +2287,7 @@ public final class MotionEvent extends InputEvent implements Parcelable { public final float getToolMajor(int pointerIndex) { return nativeGetAxisValue(mNativePtr, AXIS_TOOL_MAJOR, pointerIndex, HISTORY_CURRENT); } - + /** * Returns the length of the minor axis of an ellipse that describes the size of * the approaching tool for the given pointer @@ -2295,7 +2303,7 @@ public final class MotionEvent extends InputEvent implements Parcelable { public final float getToolMinor(int pointerIndex) { return nativeGetAxisValue(mNativePtr, AXIS_TOOL_MINOR, pointerIndex, HISTORY_CURRENT); } - + /** * Returns the orientation of the touch area and tool area in radians clockwise from vertical * for the given pointer <em>index</em> (use {@link #getPointerId(int)} to find the pointer @@ -2334,7 +2342,7 @@ public final class MotionEvent extends InputEvent implements Parcelable { /** * Populates a {@link PointerCoords} object with pointer coordinate data for * the specified pointer index. - * + * * @param pointerIndex Raw index of pointer to retrieve. Value may be from 0 * (the first pointer that is down) to {@link #getPointerCount()}-1. * @param outPointerCoords The pointer coordinate object to populate. @@ -2622,7 +2630,7 @@ public final class MotionEvent extends InputEvent implements Parcelable { public final float getHistoricalTouchMinor(int pos) { return nativeGetAxisValue(mNativePtr, AXIS_TOUCH_MINOR, 0, pos); } - + /** * {@link #getHistoricalToolMajor(int, int)} for the first pointer index (may be an * arbitrary pointer identifier). @@ -2652,7 +2660,7 @@ public final class MotionEvent extends InputEvent implements Parcelable { public final float getHistoricalToolMinor(int pos) { return nativeGetAxisValue(mNativePtr, AXIS_TOOL_MINOR, 0, pos); } - + /** * {@link #getHistoricalOrientation(int, int)} for the first pointer index (may be an * arbitrary pointer identifier). @@ -2730,7 +2738,7 @@ public final class MotionEvent extends InputEvent implements Parcelable { * (the first pointer that is down) to {@link #getPointerCount()}-1. * @param pos Which historical value to return; must be less than * {@link #getHistorySize} - * + * * @see #getHistorySize * @see #getPressure(int) * @see #AXIS_PRESSURE @@ -2748,7 +2756,7 @@ public final class MotionEvent extends InputEvent implements Parcelable { * (the first pointer that is down) to {@link #getPointerCount()}-1. * @param pos Which historical value to return; must be less than * {@link #getHistorySize} - * + * * @see #getHistorySize * @see #getSize(int) * @see #AXIS_SIZE @@ -2756,7 +2764,7 @@ public final class MotionEvent extends InputEvent implements Parcelable { public final float getHistoricalSize(int pointerIndex, int pos) { return nativeGetAxisValue(mNativePtr, AXIS_SIZE, pointerIndex, pos); } - + /** * Returns a historical touch major axis coordinate, as per {@link #getTouchMajor(int)}, that * occurred between this event and the previous event for the given pointer. @@ -2766,7 +2774,7 @@ public final class MotionEvent extends InputEvent implements Parcelable { * (the first pointer that is down) to {@link #getPointerCount()}-1. * @param pos Which historical value to return; must be less than * {@link #getHistorySize} - * + * * @see #getHistorySize * @see #getTouchMajor(int) * @see #AXIS_TOUCH_MAJOR @@ -2784,7 +2792,7 @@ public final class MotionEvent extends InputEvent implements Parcelable { * (the first pointer that is down) to {@link #getPointerCount()}-1. * @param pos Which historical value to return; must be less than * {@link #getHistorySize} - * + * * @see #getHistorySize * @see #getTouchMinor(int) * @see #AXIS_TOUCH_MINOR @@ -2802,7 +2810,7 @@ public final class MotionEvent extends InputEvent implements Parcelable { * (the first pointer that is down) to {@link #getPointerCount()}-1. * @param pos Which historical value to return; must be less than * {@link #getHistorySize} - * + * * @see #getHistorySize * @see #getToolMajor(int) * @see #AXIS_TOOL_MAJOR @@ -2820,7 +2828,7 @@ public final class MotionEvent extends InputEvent implements Parcelable { * (the first pointer that is down) to {@link #getPointerCount()}-1. * @param pos Which historical value to return; must be less than * {@link #getHistorySize} - * + * * @see #getHistorySize * @see #getToolMinor(int) * @see #AXIS_TOOL_MINOR @@ -2838,7 +2846,7 @@ public final class MotionEvent extends InputEvent implements Parcelable { * (the first pointer that is down) to {@link #getPointerCount()}-1. * @param pos Which historical value to return; must be less than * {@link #getHistorySize} - * + * * @see #getHistorySize * @see #getOrientation(int) * @see #AXIS_ORIENTATION @@ -2871,13 +2879,13 @@ public final class MotionEvent extends InputEvent implements Parcelable { * as per {@link #getPointerCoords}, that occurred between this event and the previous * event for the given pointer. * Only applies to ACTION_MOVE events. - * + * * @param pointerIndex Raw index of pointer to retrieve. Value may be from 0 * (the first pointer that is down) to {@link #getPointerCount()}-1. * @param pos Which historical value to return; must be less than * {@link #getHistorySize} * @param outPointerCoords The pointer coordinate object to populate. - * + * * @see #getHistorySize * @see #getPointerCoords * @see PointerCoords @@ -2886,7 +2894,7 @@ public final class MotionEvent extends InputEvent implements Parcelable { PointerCoords outPointerCoords) { nativeGetPointerCoords(mNativePtr, pointerIndex, pos, outPointerCoords); } - + /** * Returns a bitfield indicating which edges, if any, were touched by this * MotionEvent. For touch events, clients can use this to determine if the @@ -2943,7 +2951,7 @@ public final class MotionEvent extends InputEvent implements Parcelable { float oldY = getY(); offsetLocation(x - oldX, y - oldY); } - + /** * Applies a transformation matrix to all of the points in the event. * @@ -3427,11 +3435,11 @@ public final class MotionEvent extends InputEvent implements Parcelable { /** * Transfer object for pointer coordinates. - * + * * Objects of this type can be used to specify the pointer coordinates when * creating new {@link MotionEvent} objects and to query pointer coordinates * in bulk. - * + * * Refer to {@link InputDevice} for information about how different kinds of * input devices and sources represent pointer coordinates. */ @@ -3471,14 +3479,14 @@ public final class MotionEvent extends InputEvent implements Parcelable { * @see MotionEvent#AXIS_X */ public float x; - + /** * The Y component of the pointer movement. * * @see MotionEvent#AXIS_Y */ public float y; - + /** * A normalized value that describes the pressure applied to the device * by a finger or other tool. @@ -3489,7 +3497,7 @@ public final class MotionEvent extends InputEvent implements Parcelable { * @see MotionEvent#AXIS_PRESSURE */ public float pressure; - + /** * A normalized value that describes the approximate size of the pointer touch area * in relation to the maximum detectable size of the device. @@ -3502,7 +3510,7 @@ public final class MotionEvent extends InputEvent implements Parcelable { * @see MotionEvent#AXIS_SIZE */ public float size; - + /** * The length of the major axis of an ellipse that describes the touch area at * the point of contact. @@ -3512,7 +3520,7 @@ public final class MotionEvent extends InputEvent implements Parcelable { * @see MotionEvent#AXIS_TOUCH_MAJOR */ public float touchMajor; - + /** * The length of the minor axis of an ellipse that describes the touch area at * the point of contact. @@ -3522,7 +3530,7 @@ public final class MotionEvent extends InputEvent implements Parcelable { * @see MotionEvent#AXIS_TOUCH_MINOR */ public float touchMinor; - + /** * The length of the major axis of an ellipse that describes the size of * the approaching tool. @@ -3534,7 +3542,7 @@ public final class MotionEvent extends InputEvent implements Parcelable { * @see MotionEvent#AXIS_TOOL_MAJOR */ public float toolMajor; - + /** * The length of the minor axis of an ellipse that describes the size of * the approaching tool. @@ -3546,7 +3554,7 @@ public final class MotionEvent extends InputEvent implements Parcelable { * @see MotionEvent#AXIS_TOOL_MINOR */ public float toolMinor; - + /** * The orientation of the touch area and tool area in radians clockwise from vertical. * An angle of 0 radians indicates that the major axis of contact is oriented diff --git a/core/java/com/android/internal/os/RuntimeInit.java b/core/java/com/android/internal/os/RuntimeInit.java index 304c31d54776..f4be1289eb70 100644 --- a/core/java/com/android/internal/os/RuntimeInit.java +++ b/core/java/com/android/internal/os/RuntimeInit.java @@ -43,8 +43,8 @@ import org.apache.harmony.luni.internal.util.TimezoneGetter; * @hide */ public class RuntimeInit { - private final static String TAG = "AndroidRuntime"; - private final static boolean DEBUG = false; + final static String TAG = "AndroidRuntime"; + final static boolean DEBUG = false; /** true if commonInit() has been called */ private static boolean initialized; @@ -53,7 +53,6 @@ public class RuntimeInit { private static volatile boolean mCrashing = false; - private static final native void nativeZygoteInit(); private static final native void nativeFinishInit(); private static final native void nativeSetExitWithoutCleanup(boolean exitWithoutCleanup); @@ -133,7 +132,7 @@ public class RuntimeInit { } } - private static final void commonInit() { + protected static final void commonInit() { if (DEBUG) Slog.d(TAG, "Entered RuntimeInit!"); /* @@ -287,50 +286,7 @@ public class RuntimeInit { if (DEBUG) Slog.d(TAG, "Leaving RuntimeInit!"); } - /** - * The main function called when started through the zygote process. This - * could be unified with main(), if the native code in nativeFinishInit() - * were rationalized with Zygote startup.<p> - * - * Current recognized args: - * <ul> - * <li> <code> [--] <start class name> <args> - * </ul> - * - * @param targetSdkVersion target SDK version - * @param argv arg strings - */ - public static final void zygoteInit(int targetSdkVersion, String[] argv, ClassLoader classLoader) - throws Zygote.MethodAndArgsCaller { - if (DEBUG) Slog.d(TAG, "RuntimeInit: Starting application from zygote"); - - Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "RuntimeInit"); - redirectLogStreams(); - - commonInit(); - nativeZygoteInit(); - applicationInit(targetSdkVersion, argv, classLoader); - } - - /** - * The main function called when an application is started through a - * wrapper process. - * - * When the wrapper starts, the runtime starts {@link RuntimeInit#main} - * which calls {@link WrapperInit#main} which then calls this method. - * So we don't need to call commonInit() here. - * - * @param targetSdkVersion target SDK version - * @param argv arg strings - */ - public static void wrapperInit(int targetSdkVersion, String[] argv) - throws Zygote.MethodAndArgsCaller { - if (DEBUG) Slog.d(TAG, "RuntimeInit: Starting application from wrapper"); - - applicationInit(targetSdkVersion, argv, null); - } - - private static void applicationInit(int targetSdkVersion, String[] argv, ClassLoader classLoader) + protected static void applicationInit(int targetSdkVersion, String[] argv, ClassLoader classLoader) throws Zygote.MethodAndArgsCaller { // If the application calls System.exit(), terminate the process // immediately without running any shutdown hooks. It is not possible to diff --git a/core/java/com/android/internal/os/WrapperInit.java b/core/java/com/android/internal/os/WrapperInit.java index c03bcdf3a834..96468abd9047 100644 --- a/core/java/com/android/internal/os/WrapperInit.java +++ b/core/java/com/android/internal/os/WrapperInit.java @@ -20,7 +20,7 @@ import android.os.Process; import android.os.Trace; import android.util.BootTimingsTraceLog; import android.util.Slog; - +import com.android.internal.os.Zygote.MethodAndArgsCaller; import dalvik.system.VMRuntime; import java.io.DataOutputStream; import java.io.FileDescriptor; @@ -83,7 +83,7 @@ public class WrapperInit { // Launch the application. String[] runtimeArgs = new String[args.length - 2]; System.arraycopy(args, 2, runtimeArgs, 0, runtimeArgs.length); - RuntimeInit.wrapperInit(targetSdkVersion, runtimeArgs); + WrapperInit.wrapperInit(targetSdkVersion, runtimeArgs); } catch (Zygote.MethodAndArgsCaller caller) { caller.run(); } @@ -124,4 +124,24 @@ public class WrapperInit { Zygote.appendQuotedShellArgs(command, args); Zygote.execShell(command.toString()); } + + /** + * The main function called when an application is started through a + * wrapper process. + * + * When the wrapper starts, the runtime starts {@link RuntimeInit#main} + * which calls {@link main} which then calls this method. + * So we don't need to call commonInit() here. + * + * @param targetSdkVersion target SDK version + * @param argv arg strings + */ + private static void wrapperInit(int targetSdkVersion, String[] argv) + throws Zygote.MethodAndArgsCaller { + if (RuntimeInit.DEBUG) { + Slog.d(RuntimeInit.TAG, "RuntimeInit: Starting application from wrapper"); + } + + RuntimeInit.applicationInit(targetSdkVersion, argv, null); + } } diff --git a/core/java/com/android/internal/os/ZygoteConnection.java b/core/java/com/android/internal/os/ZygoteConnection.java index 8fe374c9266f..a7f311b33963 100644 --- a/core/java/com/android/internal/os/ZygoteConnection.java +++ b/core/java/com/android/internal/os/ZygoteConnection.java @@ -789,7 +789,7 @@ class ZygoteConnection { VMRuntime.getCurrentInstructionSet(), pipeFd, parsedArgs.remainingArgs); } else { - RuntimeInit.zygoteInit(parsedArgs.targetSdkVersion, + ZygoteInit.zygoteInit(parsedArgs.targetSdkVersion, parsedArgs.remainingArgs, null /* classLoader */); } } diff --git a/core/java/com/android/internal/os/ZygoteInit.java b/core/java/com/android/internal/os/ZygoteInit.java index 5049738f076a..8d319905b2a9 100644 --- a/core/java/com/android/internal/os/ZygoteInit.java +++ b/core/java/com/android/internal/os/ZygoteInit.java @@ -25,6 +25,7 @@ import android.icu.impl.CacheValue; import android.icu.text.DecimalFormatSymbols; import android.icu.util.ULocale; import android.net.LocalServerSocket; +import android.opengl.EGL14; import android.os.IInstalld; import android.os.Process; import android.os.RemoteException; @@ -44,6 +45,7 @@ import android.text.Hyphenator; import android.util.BootTimingsTraceLog; import android.util.EventLog; import android.util.Log; +import android.util.Slog; import android.webkit.WebViewFactory; import android.widget.TextView; @@ -81,6 +83,7 @@ public class ZygoteInit { private static final String TAG = "Zygote"; private static final String PROPERTY_DISABLE_OPENGL_PRELOADING = "ro.zygote.disable_gl_preload"; + private static final String PROPERTY_GFX_DRIVER = "ro.gfx.driver.0"; private static final String PROPERTY_RUNNING_IN_CONTAINER = "ro.boot.container"; private static final int LOG_BOOT_PROGRESS_PRELOAD_START = 3020; @@ -125,6 +128,9 @@ public class ZygoteInit { bootTimingsTraceLog.traceBegin("PreloadResources"); preloadResources(); bootTimingsTraceLog.traceEnd(); // PreloadResources + Trace.traceBegin(Trace.TRACE_TAG_DALVIK, "PreloadOpenGL"); + preloadOpenGL(); + Trace.traceEnd(Trace.TRACE_TAG_DALVIK); preloadSharedLibraries(); preloadTextResources(); // Ask the WebViewFactory to do any initialization that must run in the zygote process, @@ -174,6 +180,14 @@ public class ZygoteInit { System.loadLibrary("jnigraphics"); } + private static void preloadOpenGL() { + String driverPackageName = SystemProperties.get(PROPERTY_GFX_DRIVER); + if (!SystemProperties.getBoolean(PROPERTY_DISABLE_OPENGL_PRELOADING, false) || + driverPackageName == null || driverPackageName.isEmpty()) { + EGL14.eglGetDisplay(EGL14.EGL_DEFAULT_DISPLAY); + } + } + private static void preloadTextResources() { Hyphenator.init(); TextView.preloadFontCache(); @@ -471,7 +485,7 @@ public class ZygoteInit { /* * Pass the remaining arguments to SystemServer. */ - RuntimeInit.zygoteInit(parsedArgs.targetSdkVersion, parsedArgs.remainingArgs, cl); + ZygoteInit.zygoteInit(parsedArgs.targetSdkVersion, parsedArgs.remainingArgs, cl); } /* should never reach here */ @@ -771,4 +785,33 @@ public class ZygoteInit { */ private ZygoteInit() { } + + /** + * The main function called when started through the zygote process. This + * could be unified with main(), if the native code in nativeFinishInit() + * were rationalized with Zygote startup.<p> + * + * Current recognized args: + * <ul> + * <li> <code> [--] <start class name> <args> + * </ul> + * + * @param targetSdkVersion target SDK version + * @param argv arg strings + */ + public static final void zygoteInit(int targetSdkVersion, String[] argv, + ClassLoader classLoader) throws Zygote.MethodAndArgsCaller { + if (RuntimeInit.DEBUG) { + Slog.d(RuntimeInit.TAG, "RuntimeInit: Starting application from zygote"); + } + + Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "ZygoteInit"); + RuntimeInit.redirectLogStreams(); + + RuntimeInit.commonInit(); + ZygoteInit.nativeZygoteInit(); + RuntimeInit.applicationInit(targetSdkVersion, argv, classLoader); + } + + private static final native void nativeZygoteInit(); } diff --git a/test-runner/src/com/android/internal/util/Predicate.java b/core/java/com/android/internal/util/Predicate.java index bc6d6b31dd28..bc6d6b31dd28 100644 --- a/test-runner/src/com/android/internal/util/Predicate.java +++ b/core/java/com/android/internal/util/Predicate.java diff --git a/test-runner/src/com/android/internal/util/Predicates.java b/core/java/com/android/internal/util/Predicates.java index 30b8dc6b6ee2..c006564f129a 100644 --- a/test-runner/src/com/android/internal/util/Predicates.java +++ b/core/java/com/android/internal/util/Predicates.java @@ -21,7 +21,6 @@ import java.util.Arrays; /** * Predicates contains static methods for creating the standard set of * {@code Predicate} objects. - * @hide */ public class Predicates { diff --git a/core/jni/Android.mk b/core/jni/Android.mk index db3ea8c51bf4..dd2f365bb86a 100644 --- a/core/jni/Android.mk +++ b/core/jni/Android.mk @@ -203,6 +203,8 @@ LOCAL_C_INCLUDES += \ $(call include-path-for, libhardware)/hardware \ $(call include-path-for, libhardware_legacy)/hardware_legacy \ $(TOP)/frameworks/base/media/jni \ + $(TOP)/frameworks/rs/cpp \ + $(TOP)/frameworks/rs \ $(TOP)/system/core/base/include \ $(TOP)/system/core/include \ $(TOP)/system/core/libappfuse/include \ diff --git a/core/jni/AndroidRuntime.cpp b/core/jni/AndroidRuntime.cpp index 407e69c2421a..e237ce9f208f 100644 --- a/core/jni/AndroidRuntime.cpp +++ b/core/jni/AndroidRuntime.cpp @@ -216,7 +216,7 @@ static void com_android_internal_os_RuntimeInit_nativeFinishInit(JNIEnv* env, jo gCurRuntime->onStarted(); } -static void com_android_internal_os_RuntimeInit_nativeZygoteInit(JNIEnv* env, jobject clazz) +static void com_android_internal_os_ZygoteInit_nativeZygoteInit(JNIEnv* env, jobject clazz) { gCurRuntime->onZygoteInit(); } @@ -230,19 +230,27 @@ static void com_android_internal_os_RuntimeInit_nativeSetExitWithoutCleanup(JNIE /* * JNI registration. */ -static const JNINativeMethod gMethods[] = { - { "nativeFinishInit", "()V", - (void*) com_android_internal_os_RuntimeInit_nativeFinishInit }, - { "nativeZygoteInit", "()V", - (void*) com_android_internal_os_RuntimeInit_nativeZygoteInit }, - { "nativeSetExitWithoutCleanup", "(Z)V", - (void*) com_android_internal_os_RuntimeInit_nativeSetExitWithoutCleanup }, -}; int register_com_android_internal_os_RuntimeInit(JNIEnv* env) { + const JNINativeMethod methods[] = { + { "nativeFinishInit", "()V", + (void*) com_android_internal_os_RuntimeInit_nativeFinishInit }, + { "nativeSetExitWithoutCleanup", "(Z)V", + (void*) com_android_internal_os_RuntimeInit_nativeSetExitWithoutCleanup }, + }; return jniRegisterNativeMethods(env, "com/android/internal/os/RuntimeInit", - gMethods, NELEM(gMethods)); + methods, NELEM(methods)); +} + +int register_com_android_internal_os_ZygoteInit(JNIEnv* env) +{ + const JNINativeMethod methods[] = { + { "nativeZygoteInit", "()V", + (void*) com_android_internal_os_ZygoteInit_nativeZygoteInit }, + }; + return jniRegisterNativeMethods(env, "com/android/internal/os/ZygoteInit", + methods, NELEM(methods)); } // ---------------------------------------------------------------------- @@ -1271,6 +1279,7 @@ static int register_jni_procs(const RegJNIRec array[], size_t count, JNIEnv* env static const RegJNIRec gRegJNI[] = { REG_JNI(register_com_android_internal_os_RuntimeInit), + REG_JNI(register_com_android_internal_os_ZygoteInit), REG_JNI(register_android_os_SystemClock), REG_JNI(register_android_util_EventLog), REG_JNI(register_android_util_Log), diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml index 7b800b363e65..5b5e61e6ebdc 100644 --- a/core/res/AndroidManifest.xml +++ b/core/res/AndroidManifest.xml @@ -3252,6 +3252,10 @@ <permission android:name="android.permission.MODIFY_THEME_OVERLAY" android:protectionLevel="signature" /> + <!-- Allows an instant app to create foreground services. --> + <permission android:name="android.permission.INSTANT_APP_FOREGROUND_SERVICE" + android:protectionLevel="signature|development|ephemeral|appop" /> + <application android:process="system" android:persistent="true" android:hasCode="false" diff --git a/core/tests/coretests/src/android/provider/SettingsTest.java b/core/tests/coretests/src/android/provider/SettingsTest.java index 1ff2056498f1..019f83751a65 100644 --- a/core/tests/coretests/src/android/provider/SettingsTest.java +++ b/core/tests/coretests/src/android/provider/SettingsTest.java @@ -384,7 +384,6 @@ public class SettingsTest { Settings.Secure.AUTO_FILL_SERVICE, Settings.Secure.AUTOMATIC_STORAGE_MANAGER_BYTES_CLEARED, Settings.Secure.AUTOMATIC_STORAGE_MANAGER_DAYS_TO_RETAIN, - Settings.Secure.AUTOMATIC_STORAGE_MANAGER_DOWNLOADS_DAYS_TO_RETAIN, Settings.Secure.AUTOMATIC_STORAGE_MANAGER_ENABLED, Settings.Secure.AUTOMATIC_STORAGE_MANAGER_LAST_RUN, Settings.Secure.BACKUP_AUTO_RESTORE, @@ -402,9 +401,6 @@ public class SettingsTest { Settings.Secure.DISABLED_PRINT_SERVICES, Settings.Secure.DISABLED_SYSTEM_INPUT_METHODS, Settings.Secure.DISPLAY_DENSITY_FORCED, - Settings.Secure.DOWNLOADS_BACKUP_ALLOW_METERED, // Candidate? - Settings.Secure.DOWNLOADS_BACKUP_CHARGING_ONLY, // Candidate? - Settings.Secure.DOWNLOADS_BACKUP_ENABLED, // Candidate? Settings.Secure.DOZE_ALWAYS_ON, Settings.Secure.EMERGENCY_ASSISTANCE_APPLICATION, Settings.Secure.ENABLED_NOTIFICATION_ASSISTANT, diff --git a/test-runner/tests/src/com/android/internal/util/PredicatesTest.java b/core/tests/utiltests/src/com/android/internal/util/PredicatesTest.java index c46ff051dd33..c46ff051dd33 100644 --- a/test-runner/tests/src/com/android/internal/util/PredicatesTest.java +++ b/core/tests/utiltests/src/com/android/internal/util/PredicatesTest.java diff --git a/data/etc/platform.xml b/data/etc/platform.xml index 9cdc66047662..b394c3ccf296 100644 --- a/data/etc/platform.xml +++ b/data/etc/platform.xml @@ -177,6 +177,9 @@ access while in data mode, even if they aren't in the foreground. --> <allow-in-data-usage-save package="com.android.providers.downloads" /> + <!-- This is a core platform component that needs to freely run in the background --> + <allow-in-power-save package="com.android.cellbroadcastreceiver" /> + <!-- These are the packages that are white-listed to be able to run as system user --> <system-user-whitelisted-app package="com.android.settings" /> diff --git a/libs/hwui/Android.mk b/libs/hwui/Android.mk index 692199d7af1f..ff40c8a9fb92 100644 --- a/libs/hwui/Android.mk +++ b/libs/hwui/Android.mk @@ -189,13 +189,11 @@ hwui_c_includes += \ external/harfbuzz_ng/src \ external/freetype/include -ifneq (false,$(ANDROID_ENABLE_RENDERSCRIPT)) - hwui_cflags += -DANDROID_ENABLE_RENDERSCRIPT - hwui_c_includes += \ - $(call intermediates-dir-for,STATIC_LIBRARIES,TARGET,) \ - frameworks/rs/cpp \ - frameworks/rs -endif +# enable RENDERSCRIPT +hwui_c_includes += \ + $(call intermediates-dir-for,STATIC_LIBRARIES,TARGET,) \ + frameworks/rs/cpp \ + frameworks/rs # ------------------------ # static library diff --git a/libs/hwui/FontRenderer.cpp b/libs/hwui/FontRenderer.cpp index 4f9a3de64fc2..ee99018fb652 100644 --- a/libs/hwui/FontRenderer.cpp +++ b/libs/hwui/FontRenderer.cpp @@ -33,14 +33,11 @@ #include <algorithm> #include <cutils/properties.h> +#include <RenderScript.h> #include <SkGlyph.h> #include <SkUtils.h> #include <utils/Log.h> -#ifdef ANDROID_ENABLE_RENDERSCRIPT -#include <RenderScript.h> -#endif - namespace android { namespace uirenderer { @@ -591,17 +588,12 @@ FontRenderer::DropShadow FontRenderer::renderDropShadow(const SkPaint* paint, co return image; } -#ifdef ANDROID_ENABLE_RENDERSCRIPT // Align buffers for renderscript usage if (paddedWidth & (RS_CPU_ALLOCATION_ALIGNMENT - 1)) { paddedWidth += RS_CPU_ALLOCATION_ALIGNMENT - paddedWidth % RS_CPU_ALLOCATION_ALIGNMENT; } int size = paddedWidth * paddedHeight; uint8_t* dataBuffer = (uint8_t*) memalign(RS_CPU_ALLOCATION_ALIGNMENT, size); -#else - int size = paddedWidth * paddedHeight; - uint8_t* dataBuffer = (uint8_t*) malloc(size); -#endif memset(dataBuffer, 0, size); @@ -691,7 +683,6 @@ bool FontRenderer::renderTextOnPath(const SkPaint* paint, const Rect* clip, cons void FontRenderer::blurImage(uint8_t** image, int32_t width, int32_t height, float radius) { uint32_t intRadius = Blur::convertRadiusToInt(radius); -#ifdef ANDROID_ENABLE_RENDERSCRIPT if (width * height * intRadius >= RS_MIN_INPUT_CUTOFF && radius <= 25.0f) { uint8_t* outImage = (uint8_t*) memalign(RS_CPU_ALLOCATION_ALIGNMENT, width * height); @@ -729,7 +720,6 @@ void FontRenderer::blurImage(uint8_t** image, int32_t width, int32_t height, flo return; } } -#endif std::unique_ptr<float[]> gaussian(new float[2 * intRadius + 1]); Blur::generateGaussianWeights(gaussian.get(), radius); diff --git a/libs/hwui/FontRenderer.h b/libs/hwui/FontRenderer.h index dd9c40f89ad0..329309c1cd5c 100644 --- a/libs/hwui/FontRenderer.h +++ b/libs/hwui/FontRenderer.h @@ -34,7 +34,6 @@ #include <vector> -#ifdef ANDROID_ENABLE_RENDERSCRIPT #include "RenderScript.h" namespace RSC { class Element; @@ -42,7 +41,6 @@ namespace RSC { class ScriptIntrinsicBlur; class sp; } -#endif namespace android { namespace uirenderer { @@ -201,12 +199,10 @@ private: FontCacheHistoryTracker mHistoryTracker; #endif -#ifdef ANDROID_ENABLE_RENDERSCRIPT // RS constructs RSC::sp<RSC::RS> mRs; RSC::sp<const RSC::Element> mRsElement; RSC::sp<RSC::ScriptIntrinsicBlur> mRsScript; -#endif static void computeGaussianWeights(float* weights, int32_t radius); static void horizontalBlur(float* weights, int32_t radius, const uint8_t *source, uint8_t *dest, diff --git a/libs/hwui/hwui_static_deps.mk b/libs/hwui/hwui_static_deps.mk index f69da484af43..a75fd6a8d587 100644 --- a/libs/hwui/hwui_static_deps.mk +++ b/libs/hwui/hwui_static_deps.mk @@ -28,6 +28,5 @@ LOCAL_SHARED_LIBRARIES += \ libminikin \ libandroidfw -ifneq (false,$(ANDROID_ENABLE_RENDERSCRIPT)) - LOCAL_SHARED_LIBRARIES += libRScpp -endif +# enable RENDERSCRIPT +LOCAL_SHARED_LIBRARIES += libRScpp diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java index 43b5bc7dd313..0676efd58904 100644 --- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java +++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java @@ -1429,18 +1429,6 @@ class SettingsProtoDumpUtil { Settings.Secure.SYSTEM_NAVIGATION_KEYS_ENABLED, SecureSettingsProto.SYSTEM_NAVIGATION_KEYS_ENABLED); dumpSetting(s, p, - Settings.Secure.DOWNLOADS_BACKUP_ENABLED, - SecureSettingsProto.DOWNLOADS_BACKUP_ENABLED); - dumpSetting(s, p, - Settings.Secure.DOWNLOADS_BACKUP_ALLOW_METERED, - SecureSettingsProto.DOWNLOADS_BACKUP_ALLOW_METERED); - dumpSetting(s, p, - Settings.Secure.DOWNLOADS_BACKUP_CHARGING_ONLY, - SecureSettingsProto.DOWNLOADS_BACKUP_CHARGING_ONLY); - dumpSetting(s, p, - Settings.Secure.AUTOMATIC_STORAGE_MANAGER_DOWNLOADS_DAYS_TO_RETAIN, - SecureSettingsProto.AUTOMATIC_STORAGE_MANAGER_DOWNLOADS_DAYS_TO_RETAIN); - dumpSetting(s, p, Settings.Secure.QS_TILES, SecureSettingsProto.QS_TILES); dumpSetting(s, p, diff --git a/packages/SystemUI/src/com/android/systemui/Dependency.java b/packages/SystemUI/src/com/android/systemui/Dependency.java index 7a0108f41204..8d46b431d2c5 100644 --- a/packages/SystemUI/src/com/android/systemui/Dependency.java +++ b/packages/SystemUI/src/com/android/systemui/Dependency.java @@ -23,6 +23,7 @@ import android.os.Process; import android.util.ArrayMap; import com.android.internal.annotations.VisibleForTesting; +import com.android.internal.util.Preconditions; import com.android.systemui.assist.AssistManager; import com.android.systemui.plugins.PluginManager; import com.android.systemui.statusbar.phone.ConfigurationControllerImpl; @@ -92,18 +93,19 @@ public class Dependency extends SystemUI { /** * Key for getting a background Looper for background work. */ - public static final String BG_LOOPER = "background_loooper"; + public static final DependencyKey<Looper> BG_LOOPER = new DependencyKey<>("background_looper"); /** * Key for getting a Handler for receiving time tick broadcasts on. */ - public static final String TIME_TICK_HANDLER = "time_tick_handler"; + public static final DependencyKey<Handler> TIME_TICK_HANDLER = + new DependencyKey<>("time_tick_handler"); /** * Generic handler on the main thread. */ - public static final String MAIN_HANDLER = "main_handler"; + public static final DependencyKey<Handler> MAIN_HANDLER = new DependencyKey<>("main_handler"); - private final ArrayMap<String, Object> mDependencies = new ArrayMap<>(); - private final ArrayMap<String, DependencyProvider> mProviders = new ArrayMap<>(); + private final ArrayMap<Object, Object> mDependencies = new ArrayMap<>(); + private final ArrayMap<Object, DependencyProvider> mProviders = new ArrayMap<>(); @Override public void start() { @@ -122,87 +124,87 @@ public class Dependency extends SystemUI { return thread.getLooper(); }); mProviders.put(MAIN_HANDLER, () -> new Handler(Looper.getMainLooper())); - mProviders.put(ActivityStarter.class.getName(), () -> new ActivityStarterDelegate()); - mProviders.put(ActivityStarterDelegate.class.getName(), () -> + mProviders.put(ActivityStarter.class, () -> new ActivityStarterDelegate()); + mProviders.put(ActivityStarterDelegate.class, () -> getDependency(ActivityStarter.class)); - mProviders.put(BluetoothController.class.getName(), () -> + mProviders.put(BluetoothController.class, () -> new BluetoothControllerImpl(mContext, getDependency(BG_LOOPER))); - mProviders.put(LocationController.class.getName(), () -> + mProviders.put(LocationController.class, () -> new LocationControllerImpl(mContext, getDependency(BG_LOOPER))); - mProviders.put(RotationLockController.class.getName(), () -> + mProviders.put(RotationLockController.class, () -> new RotationLockControllerImpl(mContext)); - mProviders.put(NetworkController.class.getName(), () -> + mProviders.put(NetworkController.class, () -> new NetworkControllerImpl(mContext, getDependency(BG_LOOPER), getDependency(DeviceProvisionedController.class))); - mProviders.put(ZenModeController.class.getName(), () -> + mProviders.put(ZenModeController.class, () -> new ZenModeControllerImpl(mContext, getDependency(MAIN_HANDLER))); - mProviders.put(HotspotController.class.getName(), () -> + mProviders.put(HotspotController.class, () -> new HotspotControllerImpl(mContext)); - mProviders.put(CastController.class.getName(), () -> + mProviders.put(CastController.class, () -> new CastControllerImpl(mContext)); - mProviders.put(FlashlightController.class.getName(), () -> + mProviders.put(FlashlightController.class, () -> new FlashlightControllerImpl(mContext)); - mProviders.put(KeyguardMonitor.class.getName(), () -> + mProviders.put(KeyguardMonitor.class, () -> new KeyguardMonitorImpl(mContext)); - mProviders.put(UserSwitcherController.class.getName(), () -> + mProviders.put(UserSwitcherController.class, () -> new UserSwitcherController(mContext, getDependency(KeyguardMonitor.class), getDependency(MAIN_HANDLER), getDependency(ActivityStarter.class))); - mProviders.put(UserInfoController.class.getName(), () -> + mProviders.put(UserInfoController.class, () -> new UserInfoControllerImpl(mContext)); - mProviders.put(BatteryController.class.getName(), () -> + mProviders.put(BatteryController.class, () -> new BatteryControllerImpl(mContext)); - mProviders.put(ManagedProfileController.class.getName(), () -> + mProviders.put(ManagedProfileController.class, () -> new ManagedProfileControllerImpl(mContext)); - mProviders.put(NextAlarmController.class.getName(), () -> + mProviders.put(NextAlarmController.class, () -> new NextAlarmControllerImpl(mContext)); - mProviders.put(DataSaverController.class.getName(), () -> + mProviders.put(DataSaverController.class, () -> get(NetworkController.class).getDataSaverController()); - mProviders.put(AccessibilityController.class.getName(), () -> + mProviders.put(AccessibilityController.class, () -> new AccessibilityController(mContext)); - mProviders.put(DeviceProvisionedController.class.getName(), () -> + mProviders.put(DeviceProvisionedController.class, () -> new DeviceProvisionedControllerImpl(mContext)); - mProviders.put(PluginManager.class.getName(), () -> + mProviders.put(PluginManager.class, () -> new PluginManager(mContext)); - mProviders.put(AssistManager.class.getName(), () -> + mProviders.put(AssistManager.class, () -> new AssistManager(getDependency(DeviceProvisionedController.class), mContext)); - mProviders.put(SecurityController.class.getName(), () -> + mProviders.put(SecurityController.class, () -> new SecurityControllerImpl(mContext)); - mProviders.put(LeakDetector.class.getName(), LeakDetector::create); + mProviders.put(LeakDetector.class, LeakDetector::create); - mProviders.put(TunerService.class.getName(), () -> + mProviders.put(TunerService.class, () -> new TunerService(mContext)); - mProviders.put(StatusBarWindowManager.class.getName(), () -> + mProviders.put(StatusBarWindowManager.class, () -> new StatusBarWindowManager(mContext)); - mProviders.put(DarkIconDispatcher.class.getName(), () -> + mProviders.put(DarkIconDispatcher.class, () -> new DarkIconDispatcherImpl(mContext)); - mProviders.put(ConfigurationController.class.getName(), () -> + mProviders.put(ConfigurationController.class, () -> new ConfigurationControllerImpl(mContext)); - mProviders.put(StatusBarIconController.class.getName(), () -> + mProviders.put(StatusBarIconController.class, () -> new StatusBarIconControllerImpl(mContext)); // Put all dependencies above here so the factory can override them if it wants. @@ -225,20 +227,28 @@ public class Dependency extends SystemUI { } protected final <T> T getDependency(Class<T> cls) { - return getDependency(cls.getName()); + return getDependencyInner(cls); } - protected final <T> T getDependency(String cls) { - T obj = (T) mDependencies.get(cls); + protected final <T> T getDependency(DependencyKey<T> key) { + return getDependencyInner(key); + } + + private <T> T getDependencyInner(Object key) { + @SuppressWarnings("unchecked") + T obj = (T) mDependencies.get(key); if (obj == null) { - obj = createDependency(cls); - mDependencies.put(cls, obj); + obj = createDependency(key); + mDependencies.put(key, obj); } return obj; } @VisibleForTesting - protected <T> T createDependency(String cls) { + protected <T> T createDependency(Object cls) { + Preconditions.checkArgument(cls instanceof DependencyKey<?> || cls instanceof Class<?>); + + @SuppressWarnings("unchecked") DependencyProvider<T> provider = mProviders.get(cls); if (provider == null) { throw new IllegalArgumentException("Unsupported dependency " + cls); @@ -264,10 +274,23 @@ public class Dependency extends SystemUI { } public static <T> T get(Class<T> cls) { - return sDependency.getDependency(cls.getName()); + return sDependency.getDependency(cls); } - public static <T> T get(String cls) { + public static <T> T get(DependencyKey<T> cls) { return sDependency.getDependency(cls); } + + public static final class DependencyKey<V> { + private final String mDisplayName; + + public DependencyKey(String displayName) { + mDisplayName = displayName; + } + + @Override + public String toString() { + return mDisplayName; + } + } } diff --git a/packages/SystemUI/src/com/android/systemui/SystemUIFactory.java b/packages/SystemUI/src/com/android/systemui/SystemUIFactory.java index 1ff07010731d..411fd3d8f4f2 100644 --- a/packages/SystemUI/src/com/android/systemui/SystemUIFactory.java +++ b/packages/SystemUI/src/com/android/systemui/SystemUIFactory.java @@ -113,6 +113,6 @@ public class SystemUIFactory { return null; } - public void injectDependencies(ArrayMap<String, DependencyProvider> providers, + public void injectDependencies(ArrayMap<Object, DependencyProvider> providers, Context context) { } } diff --git a/packages/SystemUI/tests/src/com/android/systemui/DependencyTest.java b/packages/SystemUI/tests/src/com/android/systemui/DependencyTest.java index 7d1e8b0d422c..27955ecbca72 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/DependencyTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/DependencyTest.java @@ -22,10 +22,7 @@ import static org.mockito.Mockito.verify; import android.os.Looper; -import com.android.systemui.ConfigurationChangedReceiver; -import com.android.systemui.Dependency; -import com.android.systemui.Dumpable; -import com.android.systemui.SysuiTestCase; +import com.android.systemui.Dependency.DependencyKey; import com.android.systemui.statusbar.policy.FlashlightController; import org.junit.Assert; @@ -35,6 +32,10 @@ import java.io.PrintWriter; public class DependencyTest extends SysuiTestCase { + public static final DependencyKey<Dumpable> DUMPABLE = new DependencyKey<>("dumpable"); + public static final DependencyKey<ConfigurationChangedReceiver> CONFIGURATION_CHANGED_RECEIVER + = new DependencyKey<>("config_changed_receiver"); + @Test public void testClassDependency() { FlashlightController f = mock(FlashlightController.class); @@ -52,8 +53,8 @@ public class DependencyTest extends SysuiTestCase { @Test public void testDump() { Dumpable d = mock(Dumpable.class); - injectTestDependency("test", d); - Dependency.get("test"); + injectTestDependency(DUMPABLE, d); + Dependency.get(DUMPABLE); mDependency.dump(null, mock(PrintWriter.class), null); verify(d).dump(eq(null), any(), eq(null)); } @@ -61,8 +62,8 @@ public class DependencyTest extends SysuiTestCase { @Test public void testConfigurationChanged() { ConfigurationChangedReceiver d = mock(ConfigurationChangedReceiver.class); - injectTestDependency("test", d); - Dependency.get("test"); + injectTestDependency(CONFIGURATION_CHANGED_RECEIVER, d); + Dependency.get(CONFIGURATION_CHANGED_RECEIVER); mDependency.onConfigurationChanged(null); verify(d).onConfigurationChanged(eq(null)); } diff --git a/packages/SystemUI/tests/src/com/android/systemui/SysuiTestCase.java b/packages/SystemUI/tests/src/com/android/systemui/SysuiTestCase.java index 12a485ecef4b..6c454e126eaf 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/SysuiTestCase.java +++ b/packages/SystemUI/tests/src/com/android/systemui/SysuiTestCase.java @@ -25,6 +25,7 @@ import android.support.test.InstrumentationRegistry; import android.util.ArrayMap; import android.util.Log; +import com.android.systemui.Dependency.DependencyKey; import com.android.systemui.utils.TestableContext; import com.android.systemui.utils.leaks.Tracker; @@ -91,15 +92,15 @@ public abstract class SysuiTestCase { return null; } - public void injectMockDependency(Class<?> cls) { - mDependency.injectTestDependency(cls.getName(), mock(cls)); + public <T> void injectMockDependency(Class<T> cls) { + injectTestDependency(cls, mock(cls)); } - public void injectTestDependency(Class<?> cls, Object obj) { - mDependency.injectTestDependency(cls.getName(), obj); + public <T> void injectTestDependency(Class<T> cls, T obj) { + mDependency.injectTestDependency(cls, obj); } - public void injectTestDependency(String key, Object obj) { + public <T> void injectTestDependency(DependencyKey<T> key, T obj) { mDependency.injectTestDependency(key, obj); } @@ -109,16 +110,20 @@ public abstract class SysuiTestCase { } public static class TestDependency extends Dependency { - private final ArrayMap<String, Object> mObjs = new ArrayMap<>(); + private final ArrayMap<Object, Object> mObjs = new ArrayMap<>(); - private void injectTestDependency(String key, Object obj) { + private <T> void injectTestDependency(DependencyKey<T> key, T obj) { + mObjs.put(key, obj); + } + + private <T> void injectTestDependency(Class<T> key, T obj) { mObjs.put(key, obj); } @Override - protected <T> T createDependency(String cls) { - if (mObjs.containsKey(cls)) return (T) mObjs.get(cls); - return super.createDependency(cls); + protected <T> T createDependency(Object key) { + if (mObjs.containsKey(key)) return (T) mObjs.get(key); + return super.createDependency(key); } } diff --git a/packages/SystemUI/tests/src/com/android/systemui/utils/leaks/LeakCheckedTest.java b/packages/SystemUI/tests/src/com/android/systemui/utils/leaks/LeakCheckedTest.java index 6ff80983f3ef..6c5152496692 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/utils/leaks/LeakCheckedTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/utils/leaks/LeakCheckedTest.java @@ -149,10 +149,14 @@ public abstract class LeakCheckedTest extends SysuiTestCase { public void injectLeakCheckedDependencies(Class<?>... cls) { for (Class<?> c : cls) { - injectTestDependency(c, getLeakChecker(c)); + injectLeakCheckedDependency(c); } } + public <T> void injectLeakCheckedDependency(Class<T> c) { + injectTestDependency(c, getLeakChecker(c)); + } + public <T extends CallbackController> T addListening(T mock, Class<T> cls, String tag) { doAnswer(new Answer<Void>() { @Override diff --git a/services/core/java/com/android/server/NetworkScoreService.java b/services/core/java/com/android/server/NetworkScoreService.java index 0ac51b90249e..f9b5db6c0b0e 100644 --- a/services/core/java/com/android/server/NetworkScoreService.java +++ b/services/core/java/com/android/server/NetworkScoreService.java @@ -718,6 +718,15 @@ public class NetworkScoreService extends INetworkScoreService.Stub { return null; } + /** + * Returns the list of available scorer apps. The list will be empty if there are + * no valid scorers. + */ + @Override + public List<NetworkScorerAppData> getAllValidScorers() { + return mNetworkScorerAppManager.getAllValidScorers(); + } + @Override public void disableScoring() { // Only the active scorer or the system should be allowed to disable scoring. diff --git a/services/core/java/com/android/server/am/ActiveServices.java b/services/core/java/com/android/server/am/ActiveServices.java index 041fee2352e3..793a163300bd 100644 --- a/services/core/java/com/android/server/am/ActiveServices.java +++ b/services/core/java/com/android/server/am/ActiveServices.java @@ -723,6 +723,39 @@ public final class ActiveServices { if (notification == null) { throw new IllegalArgumentException("null notification"); } + // Instant apps need permission to create foreground services. + if (r.appInfo.isInstantApp()) { + final int mode = mAm.mAppOpsService.checkOperation( + AppOpsManager.OP_INSTANT_APP_START_FOREGROUND, + r.appInfo.uid, + r.appInfo.packageName); + switch (mode) { + case AppOpsManager.MODE_ALLOWED: + break; + case AppOpsManager.MODE_IGNORED: + Slog.w(TAG, "Instant app " + r.appInfo.packageName + + " does not have permission to create foreground services" + + ", ignoring."); + return; + case AppOpsManager.MODE_ERRORED: + throw new SecurityException("Instant app " + r.appInfo.packageName + + " does not have permission to create foreground services"); + default: + try { + if (AppGlobals.getPackageManager().checkPermission( + android.Manifest.permission.INSTANT_APP_FOREGROUND_SERVICE, + r.appInfo.packageName, + r.appInfo.uid) != PackageManager.PERMISSION_GRANTED) { + throw new SecurityException("Instant app " + r.appInfo.packageName + + " does not have permission to create foreground" + + "services"); + } + } catch (RemoteException e) { + throw new SecurityException("Failed to check instant app permission." , + e); + } + } + } if (r.foregroundId != id) { cancelForegroudNotificationLocked(r); r.foregroundId = id; diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java index 3ab4e6d9517b..69a3a263bbf8 100644 --- a/services/core/java/com/android/server/am/ActivityManagerService.java +++ b/services/core/java/com/android/server/am/ActivityManagerService.java @@ -8115,8 +8115,8 @@ public class ActivityManagerService extends IActivityManager.Stub // of service-launch policy, allow those callers to proceed unrestricted. int appServicesRestrictedInBackgroundLocked(int uid, String packageName, int packageTargetSdk) { // Persistent app? NB: expects that persistent uids are always active. - final UidRecord uidRec = mActiveUids.get(uid); - if (uidRec != null && uidRec.persistent) { + final UidRecord appIdRec = mActiveUids.get(UserHandle.getAppId(uid)); + if (appIdRec != null && appIdRec.persistent) { if (DEBUG_BACKGROUND_CHECK) { Slog.i(TAG, "App " + uid + "/" + packageName + " is persistent; not restricted in background"); diff --git a/services/core/java/com/android/server/clipboard/ClipboardService.java b/services/core/java/com/android/server/clipboard/ClipboardService.java index 4487d5b9b28e..94417b531c71 100644 --- a/services/core/java/com/android/server/clipboard/ClipboardService.java +++ b/services/core/java/com/android/server/clipboard/ClipboardService.java @@ -404,9 +404,11 @@ public class ClipboardService extends SystemService { return; } clipboard.primaryClip = clip; - final ClipDescription description = clipboard.primaryClip.getDescription(); - if (description != null) { - description.setTimestamp(SystemClock.elapsedRealtime()); + if (clip != null) { + final ClipDescription description = clip.getDescription(); + if (description != null) { + description.setTimestamp(SystemClock.elapsedRealtime()); + } } final long ident = Binder.clearCallingIdentity(); final int n = clipboard.primaryClipListeners.beginBroadcast(); diff --git a/services/core/java/com/android/server/emergency/EmergencyAffordanceService.java b/services/core/java/com/android/server/emergency/EmergencyAffordanceService.java index 353f4506e1e9..98771dfa1f33 100644 --- a/services/core/java/com/android/server/emergency/EmergencyAffordanceService.java +++ b/services/core/java/com/android/server/emergency/EmergencyAffordanceService.java @@ -245,23 +245,25 @@ public class EmergencyAffordanceService extends SystemService { } } } - if (neededNow != neededBefore) { - setSimNeedsEmergencyAffordance(neededNow); - } + setSimNeedsEmergencyAffordance(neededNow); return neededNow; } private void setSimNeedsEmergencyAffordance(boolean simNeedsEmergencyAffordance) { - mSimNeedsEmergencyAffordance = simNeedsEmergencyAffordance; - Settings.Global.putInt(mContext.getContentResolver(), - EMERGENCY_SIM_INSERTED_SETTING, - simNeedsEmergencyAffordance ? 1 : 0); - updateEmergencyAffordanceNeeded(); + if (simNeededAffordanceBefore() != simNeedsEmergencyAffordance) { + Settings.Global.putInt(mContext.getContentResolver(), + EMERGENCY_SIM_INSERTED_SETTING, + simNeedsEmergencyAffordance ? 1 : 0); + } + if (simNeedsEmergencyAffordance != mSimNeedsEmergencyAffordance) { + mSimNeedsEmergencyAffordance = simNeedsEmergencyAffordance; + updateEmergencyAffordanceNeeded(); + } } private boolean simNeededAffordanceBefore() { return Settings.Global.getInt(mContext.getContentResolver(), - "emergency_sim_inserted_before", 0) != 0; + EMERGENCY_SIM_INSERTED_SETTING, 0) != 0; } private boolean handleUpdateCellInfo() { diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java index 5075a41aae3b..5bd2e930f63a 100644 --- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java @@ -1886,11 +1886,14 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { } private void setDeviceOwnerSystemPropertyLocked() { - // Device owner may still be provisioned, do not set the read-only system property yet. - // Wear devices don't set device_provisioned until the device is paired, so allow - // device_owner property to be set without that. - if (!mIsWatch - && mInjector.settingsGlobalGetInt(Settings.Global.DEVICE_PROVISIONED, 0) == 0) { + final boolean deviceProvisioned = + mInjector.settingsGlobalGetInt(Settings.Global.DEVICE_PROVISIONED, 0) != 0; + // If the device is not provisioned and there is currently no device owner, do not set the + // read-only system property yet, since Device owner may still be provisioned. For Wear + // devices, if there is already a device owner then it's OK to set the property to true now, + // regardless the provision state. + final boolean isWatchWithDeviceOwner = mIsWatch && mOwners.hasDeviceOwner(); + if (!isWatchWithDeviceOwner && !deviceProvisioned) { return; } // Still at the first stage of CryptKeeper double bounce, mOwners.hasDeviceOwner is diff --git a/services/tests/servicestests/src/com/android/server/wm/WindowFrameTests.java b/services/tests/servicestests/src/com/android/server/wm/WindowFrameTests.java index 98ff0e254a19..28b6e45dc8da 100644 --- a/services/tests/servicestests/src/com/android/server/wm/WindowFrameTests.java +++ b/services/tests/servicestests/src/com/android/server/wm/WindowFrameTests.java @@ -338,9 +338,12 @@ public class WindowFrameTests { w.mDockedResizingForTest = true; w.calculatePolicyCrop(policyCrop); - // But if we are docked resizing it won't be. + // But if we are docked resizing it won't be, however we will still be + // shrunk to the decor frame and the display. final DisplayInfo displayInfo = w.getDisplayContent().getDisplayInfo(); - assertRect(policyCrop, 0, 0, 1000, 1000); + assertRect(policyCrop, 0, 0, + Math.min(pf.width(), displayInfo.logicalWidth), + Math.min(pf.height(), displayInfo.logicalHeight)); } private WindowStateWithTask createWindow(Task task, int width, int height) { |