diff options
31 files changed, 322 insertions, 206 deletions
diff --git a/api/current.txt b/api/current.txt index 884a046d88e4..5a9be90b6736 100644 --- a/api/current.txt +++ b/api/current.txt @@ -23629,6 +23629,7 @@ package android.os { field public static final java.lang.String DISALLOW_INSTALL_UNKNOWN_SOURCES = "no_install_unknown_sources"; field public static final java.lang.String DISALLOW_MODIFY_ACCOUNTS = "no_modify_accounts"; field public static final java.lang.String DISALLOW_MOUNT_PHYSICAL_MEDIA = "no_physical_media"; + field public static final java.lang.String DISALLOW_NETWORK_RESET = "no_network_reset"; field public static final java.lang.String DISALLOW_OUTGOING_BEAM = "no_outgoing_beam"; field public static final java.lang.String DISALLOW_OUTGOING_CALLS = "no_outgoing_calls"; field public static final java.lang.String DISALLOW_REMOVE_USER = "no_remove_user"; diff --git a/api/system-current.txt b/api/system-current.txt index 04acd18f50c4..b4315fe1ecb2 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -25552,6 +25552,7 @@ package android.os { field public static final java.lang.String DISALLOW_INSTALL_UNKNOWN_SOURCES = "no_install_unknown_sources"; field public static final java.lang.String DISALLOW_MODIFY_ACCOUNTS = "no_modify_accounts"; field public static final java.lang.String DISALLOW_MOUNT_PHYSICAL_MEDIA = "no_physical_media"; + field public static final java.lang.String DISALLOW_NETWORK_RESET = "no_network_reset"; field public static final java.lang.String DISALLOW_OUTGOING_BEAM = "no_outgoing_beam"; field public static final java.lang.String DISALLOW_OUTGOING_CALLS = "no_outgoing_calls"; field public static final java.lang.String DISALLOW_REMOVE_USER = "no_remove_user"; diff --git a/core/java/android/content/res/ColorStateList.java b/core/java/android/content/res/ColorStateList.java index 14bfac5a74bb..579634f1290a 100644 --- a/core/java/android/content/res/ColorStateList.java +++ b/core/java/android/content/res/ColorStateList.java @@ -382,6 +382,14 @@ public class ColorStateList implements Parcelable { defaultAlphaMod = 1.0f; } + // Extract the theme attributes, if any, before attempting to + // read from the typed array. This prevents a crash if we have + // unresolved attrs. + themeAttrsList[i] = a.extractThemeAttrs(themeAttrsList[i]); + if (themeAttrsList[i] != null) { + hasUnresolvedAttrs = true; + } + final int baseColor = a.getColor( R.styleable.ColorStateListItem_color, mColors[i]); final float alphaMod = a.getFloat( @@ -391,12 +399,6 @@ public class ColorStateList implements Parcelable { // Account for any configuration changes. mChangingConfigurations |= a.getChangingConfigurations(); - // Extract the theme attributes, if any. - themeAttrsList[i] = a.extractThemeAttrs(themeAttrsList[i]); - if (themeAttrsList[i] != null) { - hasUnresolvedAttrs = true; - } - a.recycle(); } } diff --git a/core/java/android/hardware/camera2/CameraCaptureSession.java b/core/java/android/hardware/camera2/CameraCaptureSession.java index b3e7cfcf2c7c..c22ee5f0d6db 100644 --- a/core/java/android/hardware/camera2/CameraCaptureSession.java +++ b/core/java/android/hardware/camera2/CameraCaptureSession.java @@ -654,16 +654,22 @@ public abstract class CameraCaptureSession implements AutoCloseable { /** * This method is called when the camera device has started capturing - * the output image for the request, at the beginning of image exposure. + * the output image for the request, at the beginning of image exposure, or + * when the camera device has started processing an input image for a reprocess + * request. * - * <p>This callback is invoked right as the capture of a frame begins, - * so it is the most appropriate time for playing a shutter sound, - * or triggering UI indicators of capture.</p> + * <p>For a regular capture request, this callback is invoked right as + * the capture of a frame begins, so it is the most appropriate time + * for playing a shutter sound, or triggering UI indicators of capture.</p> * * <p>The request that is being used for this capture is provided, along - * with the actual timestamp for the start of exposure. This timestamp - * matches the timestamp that will be included in - * {@link CaptureResult#SENSOR_TIMESTAMP the result timestamp field}, + * with the actual timestamp for the start of exposure. For a reprocess + * request, this timestamp will be the input image's start of exposure + * which matches {@link CaptureResult#SENSOR_TIMESTAMP the result timestamp field} + * of the {@link TotalCaptureResult} that was used to + * {@link CameraDevice#createReprocessCaptureRequest create the reprocess request}. + * This timestamp matches the timestamps that will be + * included in {@link CaptureResult#SENSOR_TIMESTAMP the result timestamp field}, * and in the buffers sent to each output Surface. These buffer * timestamps are accessible through, for example, * {@link android.media.Image#getTimestamp() Image.getTimestamp()} or @@ -679,7 +685,9 @@ public abstract class CameraCaptureSession implements AutoCloseable { * * @param session the session returned by {@link CameraDevice#createCaptureSession} * @param request the request for the capture that just begun - * @param timestamp the timestamp at start of capture, in nanoseconds. + * @param timestamp the timestamp at start of capture for a regular request, or + * the timestamp at the input image's start of capture for a + * reprocess request, in nanoseconds. * @param frameNumber the frame number for this capture * * @see android.media.MediaActionSound diff --git a/core/java/android/hardware/camera2/CaptureResult.java b/core/java/android/hardware/camera2/CaptureResult.java index f4017d0184b3..96faad285af6 100644 --- a/core/java/android/hardware/camera2/CaptureResult.java +++ b/core/java/android/hardware/camera2/CaptureResult.java @@ -2988,6 +2988,10 @@ public class CaptureResult extends CameraMetadata<CaptureResult.Key<?>> { * timestamps measure time in the same timebase as {@link android.os.SystemClock#elapsedRealtimeNanos }, and they can * be compared to other timestamps from other subsystems that * are using that base.</p> + * <p>For reprocessing, the timestamp will match the start of exposure of + * the input image, i.e. {@link CaptureResult#SENSOR_TIMESTAMP the + * timestamp} in the TotalCaptureResult that was used to create the + * reprocess capture request.</p> * <p><b>Units</b>: Nanoseconds</p> * <p><b>Range of valid values:</b><br> * > 0</p> diff --git a/core/java/android/hardware/camera2/legacy/LegacyMetadataMapper.java b/core/java/android/hardware/camera2/legacy/LegacyMetadataMapper.java index 2de846cbbb94..943e421e5ad2 100644 --- a/core/java/android/hardware/camera2/legacy/LegacyMetadataMapper.java +++ b/core/java/android/hardware/camera2/legacy/LegacyMetadataMapper.java @@ -752,12 +752,14 @@ public class LegacyMetadataMapper { CameraCharacteristics.CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES , CameraCharacteristics.CONTROL_AE_COMPENSATION_RANGE , CameraCharacteristics.CONTROL_AE_COMPENSATION_STEP , + CameraCharacteristics.CONTROL_AE_LOCK_AVAILABLE , CameraCharacteristics.CONTROL_AF_AVAILABLE_MODES , CameraCharacteristics.CONTROL_AVAILABLE_EFFECTS , CameraCharacteristics.CONTROL_AVAILABLE_MODES , CameraCharacteristics.CONTROL_AVAILABLE_SCENE_MODES , CameraCharacteristics.CONTROL_AVAILABLE_VIDEO_STABILIZATION_MODES , CameraCharacteristics.CONTROL_AWB_AVAILABLE_MODES , + CameraCharacteristics.CONTROL_AWB_LOCK_AVAILABLE , CameraCharacteristics.CONTROL_MAX_REGIONS , CameraCharacteristics.FLASH_INFO_AVAILABLE , CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL , diff --git a/core/java/android/os/Build.java b/core/java/android/os/Build.java index dfd523a6c2ce..50eed3e9df7e 100644 --- a/core/java/android/os/Build.java +++ b/core/java/android/os/Build.java @@ -685,8 +685,6 @@ public class Build { final String bootimage = SystemProperties.get("ro.bootimage.build.fingerprint"); final String requiredBootloader = SystemProperties.get("ro.build.expect.bootloader"); final String currentBootloader = SystemProperties.get("ro.bootloader"); - final String requiredRecovery = SystemProperties.get("ro.expect.recovery_id"); - final String currentRecovery = SystemProperties.get("ro.recovery_id"); final String requiredRadio = SystemProperties.get("ro.build.expect.baseband"); final String currentRadio = SystemProperties.get("gsm.version.baseband"); @@ -703,6 +701,7 @@ public class Build { } } + /* TODO: Figure out issue with checks failing if (!TextUtils.isEmpty(bootimage)) { if (!Objects.equals(system, bootimage)) { Slog.e(TAG, "Mismatched fingerprints; system reported " + system @@ -719,15 +718,6 @@ public class Build { } } - if (!TextUtils.isEmpty(requiredRecovery)) { - if (!Objects.equals(currentRecovery, requiredRecovery)) { - Slog.e(TAG, "Mismatched recovery version: build requires " + requiredRecovery - + " but runtime reports " + currentRecovery); - return false; - } - } - - /* TODO: uncomment when new bootloader lands b/20860620 if (!TextUtils.isEmpty(requiredRadio)) { if (!Objects.equals(currentRadio, requiredRadio)) { Slog.e(TAG, "Mismatched radio version: build requires " + requiredRadio diff --git a/core/java/android/os/UserManager.java b/core/java/android/os/UserManager.java index a81b83f00299..ef7e747273d3 100644 --- a/core/java/android/os/UserManager.java +++ b/core/java/android/os/UserManager.java @@ -200,6 +200,20 @@ public class UserManager { public static final String DISALLOW_CONFIG_TETHERING = "no_config_tethering"; /** + * Specifies if a user is disallowed from resetting network settings + * from Settings. This can only be set by device owners and profile owners on the primary user. + * The default value is <code>false</code>. + * <p/>This restriction has no effect on secondary users and managed profiles since only the + * primary user can reset the network settings of the device. + * + * <p/>Key for user restrictions. + * <p/>Type: Boolean + * @see #setUserRestrictions(Bundle) + * @see #getUserRestrictions() + */ + public static final String DISALLOW_NETWORK_RESET = "no_network_reset"; + + /** * Specifies if a user is disallowed from factory resetting * from Settings. This can only be set by device owners and profile owners on the primary user. * The default value is <code>false</code>. diff --git a/core/java/android/view/ScaleGestureDetector.java b/core/java/android/view/ScaleGestureDetector.java index b055efed441a..7b0f1fbe7ee1 100644 --- a/core/java/android/view/ScaleGestureDetector.java +++ b/core/java/android/view/ScaleGestureDetector.java @@ -320,8 +320,8 @@ public class ScaleGestureDetector { } final int count = event.getPointerCount(); - final boolean isStylusButtonDown = (event.getToolType(0) == MotionEvent.TOOL_TYPE_STYLUS) - && (event.getButtonState() & MotionEvent.BUTTON_SECONDARY) != 0; + final boolean isStylusButtonDown = + (event.getButtonState() & MotionEvent.BUTTON_STYLUS_PRIMARY) != 0; final boolean anchoredScaleCancelled = mAnchoredScaleMode == ANCHORED_SCALE_MODE_STYLUS && !isStylusButtonDown; diff --git a/core/java/android/view/accessibility/AccessibilityNodeInfo.java b/core/java/android/view/accessibility/AccessibilityNodeInfo.java index 901a32daf05e..b454d1c0e68a 100644 --- a/core/java/android/view/accessibility/AccessibilityNodeInfo.java +++ b/core/java/android/view/accessibility/AccessibilityNodeInfo.java @@ -2737,10 +2737,10 @@ public class AccessibilityNodeInfo implements Parcelable { if (mCollectionItemInfo != null) { parcel.writeInt(1); - parcel.writeInt(mCollectionItemInfo.getColumnIndex()); - parcel.writeInt(mCollectionItemInfo.getColumnSpan()); parcel.writeInt(mCollectionItemInfo.getRowIndex()); parcel.writeInt(mCollectionItemInfo.getRowSpan()); + parcel.writeInt(mCollectionItemInfo.getColumnIndex()); + parcel.writeInt(mCollectionItemInfo.getColumnSpan()); parcel.writeInt(mCollectionItemInfo.isHeading() ? 1 : 0); parcel.writeInt(mCollectionItemInfo.isSelected() ? 1 : 0); } else { diff --git a/core/java/android/widget/ListView.java b/core/java/android/widget/ListView.java index 7dcaa1f0dfa6..f8b965fce8c2 100644 --- a/core/java/android/widget/ListView.java +++ b/core/java/android/widget/ListView.java @@ -16,6 +16,7 @@ package android.widget; +import android.annotation.Nullable; import android.os.Bundle; import android.os.Trace; import com.android.internal.R; @@ -144,7 +145,7 @@ public class ListView extends AbsListView { } public ListView(Context context, AttributeSet attrs) { - this(context, attrs, com.android.internal.R.attr.listViewStyle); + this(context, attrs, R.attr.listViewStyle); } public ListView(Context context, AttributeSet attrs, int defStyleAttr) { @@ -155,38 +156,37 @@ public class ListView extends AbsListView { super(context, attrs, defStyleAttr, defStyleRes); final TypedArray a = context.obtainStyledAttributes( - attrs, com.android.internal.R.styleable.ListView, defStyleAttr, defStyleRes); + attrs, R.styleable.ListView, defStyleAttr, defStyleRes); - CharSequence[] entries = a.getTextArray( - com.android.internal.R.styleable.ListView_entries); + final CharSequence[] entries = a.getTextArray(R.styleable.ListView_entries); if (entries != null) { - setAdapter(new ArrayAdapter<CharSequence>(context, - com.android.internal.R.layout.simple_list_item_1, entries)); + setAdapter(new ArrayAdapter<>(context, R.layout.simple_list_item_1, entries)); } - final Drawable d = a.getDrawable(com.android.internal.R.styleable.ListView_divider); + final Drawable d = a.getDrawable(R.styleable.ListView_divider); if (d != null) { - // If a divider is specified use its intrinsic height for divider height + // Use an implicit divider height which may be explicitly + // overridden by android:dividerHeight further down. setDivider(d); } - - final Drawable osHeader = a.getDrawable( - com.android.internal.R.styleable.ListView_overScrollHeader); + + final Drawable osHeader = a.getDrawable(R.styleable.ListView_overScrollHeader); if (osHeader != null) { setOverscrollHeader(osHeader); } - final Drawable osFooter = a.getDrawable( - com.android.internal.R.styleable.ListView_overScrollFooter); + final Drawable osFooter = a.getDrawable(R.styleable.ListView_overScrollFooter); if (osFooter != null) { setOverscrollFooter(osFooter); } - // Use the height specified, zero being the default - final int dividerHeight = a.getDimensionPixelSize( - com.android.internal.R.styleable.ListView_dividerHeight, 0); - if (dividerHeight != 0) { - setDividerHeight(dividerHeight); + // Use an explicit divider height, if specified. + if (a.hasValueOrEmpty(R.styleable.ListView_dividerHeight)) { + final int dividerHeight = a.getDimensionPixelSize( + R.styleable.ListView_dividerHeight, 0); + if (dividerHeight != 0) { + setDividerHeight(dividerHeight); + } } mHeaderDividersEnabled = a.getBoolean(R.styleable.ListView_headerDividersEnabled, true); @@ -3434,18 +3434,23 @@ public class ListView extends AbsListView { * Returns the drawable that will be drawn between each item in the list. * * @return the current drawable drawn between list elements + * @attr ref R.styleable#ListView_divider */ + @Nullable public Drawable getDivider() { return mDivider; } /** - * Sets the drawable that will be drawn between each item in the list. If the drawable does - * not have an intrinsic height, you should also call {@link #setDividerHeight(int)} + * Sets the drawable that will be drawn between each item in the list. + * <p> + * <strong>Note:</strong> If the drawable does not have an intrinsic + * height, you should also call {@link #setDividerHeight(int)}. * - * @param divider The drawable to use. + * @param divider the drawable to use + * @attr ref R.styleable#ListView_divider */ - public void setDivider(Drawable divider) { + public void setDivider(@Nullable Drawable divider) { if (divider != null) { mDividerHeight = divider.getIntrinsicHeight(); } else { diff --git a/core/java/com/android/internal/policy/IKeyguardService.aidl b/core/java/com/android/internal/policy/IKeyguardService.aidl index f93b1a1b94fd..7ab4651979e9 100644 --- a/core/java/com/android/internal/policy/IKeyguardService.aidl +++ b/core/java/com/android/internal/policy/IKeyguardService.aidl @@ -22,6 +22,7 @@ import com.android.internal.policy.IKeyguardExitCallback; import android.os.Bundle; oneway interface IKeyguardService { + /** * Sets the Keyguard as occluded when a window dismisses the Keyguard with flag * FLAG_SHOW_ON_LOCK_SCREEN. @@ -36,8 +37,27 @@ oneway interface IKeyguardService { void dismiss(); void onDreamingStarted(); void onDreamingStopped(); - void onScreenTurnedOff(int reason); - void onScreenTurnedOn(IKeyguardShowCallback callback); + + /** + * Called when the device has started going to sleep. + * + * @param why {@link #OFF_BECAUSE_OF_USER}, {@link #OFF_BECAUSE_OF_ADMIN}, + * or {@link #OFF_BECAUSE_OF_TIMEOUT}. + */ + void onStartedGoingToSleep(int reason); + + /** + * Called when the device has finished going to sleep. + * + * @param why {@link #OFF_BECAUSE_OF_USER}, {@link #OFF_BECAUSE_OF_ADMIN}, + * or {@link #OFF_BECAUSE_OF_TIMEOUT}. + */ + void onFinishedGoingToSleep(int reason); + + /** + * Called when the device has started waking up. + */ + void onStartedWakingUp(IKeyguardShowCallback callback); void setKeyguardEnabled(boolean enabled); void onSystemReady(); void doKeyguardTimeout(in Bundle options); diff --git a/core/java/com/android/internal/widget/SwipeDismissLayout.java b/core/java/com/android/internal/widget/SwipeDismissLayout.java index 6d4e0583b4e1..35ed63b7eb1d 100644 --- a/core/java/com/android/internal/widget/SwipeDismissLayout.java +++ b/core/java/com/android/internal/widget/SwipeDismissLayout.java @@ -16,9 +16,11 @@ package com.android.internal.widget; -import android.animation.TimeInterpolator; import android.app.Activity; +import android.content.BroadcastReceiver; import android.content.Context; +import android.content.Intent; +import android.content.IntentFilter; import android.content.res.TypedArray; import android.util.AttributeSet; import android.util.Log; @@ -28,8 +30,6 @@ import android.view.View; import android.view.ViewConfiguration; import android.view.ViewGroup; import android.view.ViewTreeObserver; -import android.view.animation.AccelerateInterpolator; -import android.view.animation.DecelerateInterpolator; import android.widget.FrameLayout; /** @@ -62,10 +62,6 @@ public class SwipeDismissLayout extends FrameLayout { // Cached ViewConfiguration and system-wide constant values private int mSlop; private int mMinFlingVelocity; - private int mMaxFlingVelocity; - private long mAnimationTime; - private TimeInterpolator mCancelInterpolator; - private TimeInterpolator mDismissInterpolator; // Transient properties private int mActiveTouchId; @@ -92,6 +88,18 @@ public class SwipeDismissLayout extends FrameLayout { } } }; + private BroadcastReceiver mScreenOffReceiver = new BroadcastReceiver() { + @Override + public void onReceive(Context context, Intent intent) { + if (mDismissed) { + dismiss(); + } else { + cancel(); + } + resetMembers(); + } + }; + private IntentFilter mScreenOffFilter = new IntentFilter(Intent.ACTION_SCREEN_OFF); private float mLastX; @@ -114,11 +122,6 @@ public class SwipeDismissLayout extends FrameLayout { ViewConfiguration vc = ViewConfiguration.get(context); mSlop = vc.getScaledTouchSlop(); mMinFlingVelocity = vc.getScaledMinimumFlingVelocity(); - mMaxFlingVelocity = vc.getScaledMaximumFlingVelocity(); - mAnimationTime = getContext().getResources().getInteger( - android.R.integer.config_shortAnimTime); - mCancelInterpolator = new DecelerateInterpolator(1.5f); - mDismissInterpolator = new AccelerateInterpolator(1.5f); TypedArray a = context.getTheme().obtainStyledAttributes( com.android.internal.R.styleable.Theme); mUseDynamicTranslucency = !a.hasValue( @@ -141,15 +144,17 @@ public class SwipeDismissLayout extends FrameLayout { getViewTreeObserver().addOnEnterAnimationCompleteListener( mOnEnterAnimationCompleteListener); } + getContext().registerReceiver(mScreenOffReceiver, mScreenOffFilter); } @Override protected void onDetachedFromWindow() { - super.onDetachedFromWindow(); + getContext().unregisterReceiver(mScreenOffReceiver); if (getContext() instanceof Activity) { getViewTreeObserver().removeOnEnterAnimationCompleteListener( mOnEnterAnimationCompleteListener); } + super.onDetachedFromWindow(); } @Override diff --git a/docs/html/about/dashboards/index.jd b/docs/html/about/dashboards/index.jd index ab3069e0c09a..2397dfebb6bf 100644 --- a/docs/html/about/dashboards/index.jd +++ b/docs/html/about/dashboards/index.jd @@ -57,12 +57,12 @@ Platform Versions</a>.</p> </div> -<p style="clear:both"><em>Data collected during a 7-day period ending on May 4, 2015. +<p style="clear:both"><em>Data collected during a 7-day period ending on June 1, 2015. <br/>Any versions with less than 0.1% distribution are not shown.</em> </p> -<p class="note"><strong>Note:</strong> Because this data is gathered from the new Google Play -Store app, which supports Android 2.2 and above, devices running older versions are not included. +<p class="note"><strong>Note:</strong> This data is gathered from the new Google Play +Store app, which supports Android 2.2 and above, so devices running older versions are not included. However, in August, 2013, versions older than Android 2.2 accounted for about 1% of devices that <em>checked in</em> to Google servers (not those that actually visited Google Play Store). </p> @@ -88,7 +88,7 @@ Screens</a>.</p> </div> -<p style="clear:both"><em>Data collected during a 7-day period ending on May 4, 2015. +<p style="clear:both"><em>Data collected during a 7-day period ending on June 1, 2015. <br/>Any screen configurations with less than 0.1% distribution are not shown.</em></p> @@ -108,7 +108,7 @@ support for any lower version (for example, support for version 2.0 also implies <img alt="" style="float:right" -src="//chart.googleapis.com/chart?chl=GL%202.0%7CGL%203.0%7CGL%203.1&chf=bg%2Cs%2C00000000&chd=t%3A64.1%2C34.5%2C1.4&chco=c4df9b%2C6fad0c&cht=p&chs=400x250"> +src="//chart.googleapis.com/chart?chl=GL%202.0%7CGL%203.0%7CGL%203.1&chf=bg%2Cs%2C00000000&chd=t%3A63.0%2C35.0%2C2.0&chco=c4df9b%2C6fad0c&cht=p&chs=400x250"> <p>To declare which version of OpenGL ES your application requires, you should use the {@code android:glEsVersion} attribute of the <a @@ -126,21 +126,21 @@ uses.</p> </tr> <tr> <td>2.0</td> -<td>64.1%</td> +<td>63.0%</td> </tr> <tr> <td>3.0</td> -<td>34.5%</td> +<td>35.0%</td> </tr> <tr> <td>3.1</td> -<td>1.4%</td> +<td>2.0%</td> </tr> </table> -<p style="clear:both"><em>Data collected during a 7-day period ending on May 4, 2015</em></p> +<p style="clear:both"><em>Data collected during a 7-day period ending on June 1, 2015</em></p> @@ -158,7 +158,7 @@ uses.</p> var VERSION_DATA = [ { - "chart": "//chart.googleapis.com/chart?chf=bg%2Cs%2C00000000&chd=t%3A0.3%2C5.7%2C5.3%2C39.2%2C39.8%2C9.7&chl=Froyo%7CGingerbread%7CIce%20Cream%20Sandwich%7CJelly%20Bean%7CKitKat%7CLollipop&chs=500x250&cht=p&chco=c4df9b%2C6fad0c", + "chart": "//chart.googleapis.com/chart?chco=c4df9b%2C6fad0c&cht=p&chs=500x250&chl=Froyo%7CGingerbread%7CIce%20Cream%20Sandwich%7CJelly%20Bean%7CKitKat%7CLollipop&chd=t%3A0.3%2C5.6%2C5.1%2C37.4%2C39.2%2C12.4&chf=bg%2Cs%2C00000000", "data": [ { "api": 8, @@ -168,42 +168,42 @@ var VERSION_DATA = { "api": 10, "name": "Gingerbread", - "perc": "5.7" + "perc": "5.6" }, { "api": 15, "name": "Ice Cream Sandwich", - "perc": "5.3" + "perc": "5.1" }, { "api": 16, "name": "Jelly Bean", - "perc": "15.6" + "perc": "14.7" }, { "api": 17, "name": "Jelly Bean", - "perc": "18.1" + "perc": "17.5" }, { "api": 18, "name": "Jelly Bean", - "perc": "5.5" + "perc": "5.2" }, { "api": 19, "name": "KitKat", - "perc": "39.8" + "perc": "39.2" }, { "api": 21, "name": "Lollipop", - "perc": "9.0" + "perc": "11.6" }, { "api": 22, "name": "Lollipop", - "perc": "0.7" + "perc": "0.8" } ] } @@ -222,23 +222,23 @@ var SCREEN_DATA = "xhdpi": "0.6" }, "Normal": { - "hdpi": "39.5", + "hdpi": "39.9", "mdpi": "7.6", "tvdpi": "0.1", "xhdpi": "19.8", - "xxhdpi": "16.2" + "xxhdpi": "15.9" }, "Small": { "ldpi": "4.1" }, "Xlarge": { "hdpi": "0.3", - "mdpi": "3.2", + "mdpi": "3.1", "xhdpi": "0.6" } }, - "densitychart": "//chart.googleapis.com/chart?chf=bg%2Cs%2C00000000&chd=t%3A4.5%2C15.6%2C2.3%2C40.4%2C21.0%2C16.2&chl=ldpi%7Cmdpi%7Ctvdpi%7Chdpi%7Cxhdpi%7Cxxhdpi&chs=400x250&cht=p&chco=c4df9b%2C6fad0c", - "layoutchart": "//chart.googleapis.com/chart?chf=bg%2Cs%2C00000000&chd=t%3A4.1%2C8.6%2C83.2%2C4.1&chl=Xlarge%7CLarge%7CNormal%7CSmall&chs=400x250&cht=p&chco=c4df9b%2C6fad0c" + "densitychart": "//chart.googleapis.com/chart?chco=c4df9b%2C6fad0c&cht=p&chs=400x250&chl=ldpi%7Cmdpi%7Ctvdpi%7Chdpi%7Cxhdpi%7Cxxhdpi&chd=t%3A4.5%2C15.5%2C2.3%2C40.8%2C21.0%2C15.9&chf=bg%2Cs%2C00000000", + "layoutchart": "//chart.googleapis.com/chart?chco=c4df9b%2C6fad0c&cht=p&chs=400x250&chl=Xlarge%7CLarge%7CNormal%7CSmall&chd=t%3A4.0%2C8.6%2C83.3%2C4.1&chf=bg%2Cs%2C00000000" } ]; diff --git a/keystore/java/android/security/keystore/AndroidKeyStoreSpi.java b/keystore/java/android/security/keystore/AndroidKeyStoreSpi.java index f159c304a2b4..701bd67a847a 100644 --- a/keystore/java/android/security/keystore/AndroidKeyStoreSpi.java +++ b/keystore/java/android/security/keystore/AndroidKeyStoreSpi.java @@ -621,9 +621,6 @@ public class AndroidKeyStoreSpi extends KeyStoreSpi { (params.getKeyValidityForConsumptionEnd() != null) ? params.getKeyValidityForConsumptionEnd() : new Date(Long.MAX_VALUE)); - // TODO: Remove this once keymaster does not require us to specify the size of imported key. - args.addInt(KeymasterDefs.KM_TAG_KEY_SIZE, keyMaterial.length * 8); - if (((purposes & KeyProperties.PURPOSE_ENCRYPT) != 0) && (!params.isRandomizedEncryptionRequired())) { // Permit caller-provided IV when encrypting with this key diff --git a/packages/SettingsLib/src/com/android/settingslib/wifi/WifiTracker.java b/packages/SettingsLib/src/com/android/settingslib/wifi/WifiTracker.java index 68803b39ea1d..f32493375e9e 100644 --- a/packages/SettingsLib/src/com/android/settingslib/wifi/WifiTracker.java +++ b/packages/SettingsLib/src/com/android/settingslib/wifi/WifiTracker.java @@ -205,7 +205,9 @@ public class WifiTracker { * Gets the current list of access points. */ public List<AccessPoint> getAccessPoints() { - return mAccessPoints; + synchronized (mAccessPoints) { + return new ArrayList<>(mAccessPoints); + } } public WifiManager getManager() { @@ -230,14 +232,14 @@ public class WifiTracker { public void dump(PrintWriter pw) { pw.println(" - wifi tracker ------"); - for (AccessPoint accessPoint : mAccessPoints) { + for (AccessPoint accessPoint : getAccessPoints()) { pw.println(" " + accessPoint); } } private void updateAccessPoints() { // Swap the current access points into a cached list. - ArrayList<AccessPoint> cachedAccessPoints = new ArrayList<>(mAccessPoints); + List<AccessPoint> cachedAccessPoints = getAccessPoints(); ArrayList<AccessPoint> accessPoints = new ArrayList<>(); // Clear out the configs so we don't think something is saved when it isn't. @@ -330,7 +332,7 @@ public class WifiTracker { mMainHandler.sendEmptyMessage(MainHandler.MSG_ACCESS_POINT_CHANGED); } - private AccessPoint getCachedOrCreate(ScanResult result, ArrayList<AccessPoint> cache) { + private AccessPoint getCachedOrCreate(ScanResult result, List<AccessPoint> cache) { final int N = cache.size(); for (int i = 0; i < N; i++) { if (cache.get(i).matches(result)) { @@ -342,7 +344,7 @@ public class WifiTracker { return new AccessPoint(mContext, result); } - private AccessPoint getCachedOrCreate(WifiConfiguration config, ArrayList<AccessPoint> cache) { + private AccessPoint getCachedOrCreate(WifiConfiguration config, List<AccessPoint> cache) { final int N = cache.size(); for (int i = 0; i < N; i++) { if (cache.get(i).matches(config)) { @@ -380,7 +382,9 @@ public class WifiTracker { } } if (reorder) { - Collections.sort(mAccessPoints); + synchronized (mAccessPoints) { + Collections.sort(mAccessPoints); + } mMainHandler.sendEmptyMessage(MainHandler.MSG_ACCESS_POINT_CHANGED); } } diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardService.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardService.java index 73fa2ed1a4b6..98558b49bfd8 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardService.java +++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardService.java @@ -108,15 +108,21 @@ public class KeyguardService extends Service { } @Override // Binder interface - public void onScreenTurnedOff(int reason) { + public void onStartedGoingToSleep(int reason) { checkPermission(); - mKeyguardViewMediator.onScreenTurnedOff(reason); + mKeyguardViewMediator.onStartedGoingToSleep(reason); } @Override // Binder interface - public void onScreenTurnedOn(IKeyguardShowCallback callback) { + public void onFinishedGoingToSleep(int reason) { checkPermission(); - mKeyguardViewMediator.onScreenTurnedOn(callback); + mKeyguardViewMediator.onFinishedGoingToSleep(reason); + } + + @Override // Binder interface + public void onStartedWakingUp(IKeyguardShowCallback callback) { + checkPermission(); + mKeyguardViewMediator.onStartedWakingUp(callback); } @Override // Binder interface diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java index 74962ec09319..bc4210598bc8 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java +++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java @@ -188,11 +188,6 @@ public class KeyguardViewMediator extends SystemUI { private boolean mBootCompleted; private boolean mBootSendUserPresent; - // Whether the next call to playSounds() should be skipped. Defaults to - // true because the first lock (on boot) should be silent. - private boolean mSuppressNextLockSound = true; - - /** High level access to the power manager for WakeLocks */ private PowerManager mPM; @@ -255,7 +250,7 @@ public class KeyguardViewMediator extends SystemUI { private KeyguardUpdateMonitor mUpdateMonitor; - private boolean mScreenOn; + private boolean mDeviceInteractive; // last known state of the cellular connection private String mPhoneState = TelephonyManager.EXTRA_STATE_IDLE; @@ -306,6 +301,18 @@ public class KeyguardViewMediator extends SystemUI { private final ArrayList<IKeyguardStateCallback> mKeyguardStateCallbacks = new ArrayList<>(); + /** + * When starting going to sleep, we figured out that we need to reset Keyguard state and this + * should be committed when finished going to sleep. + */ + private boolean mPendingReset; + + /** + * When starting goign to sleep, we figured out that we need to lock Keyguard and this should be + * committed when finished going to sleep. + */ + private boolean mPendingLock; + KeyguardUpdateMonitorCallback mUpdateCallback = new KeyguardUpdateMonitorCallback() { @Override @@ -341,7 +348,7 @@ public class KeyguardViewMediator extends SystemUI { public void onPhoneStateChanged(int phoneState) { synchronized (KeyguardViewMediator.this) { if (TelephonyManager.CALL_STATE_IDLE == phoneState // call ending - && !mScreenOn // screen off + && !mDeviceInteractive // screen off && mExternallyEnabled) { // not disabled by any app // note: this is a way to gracefully reenable the keyguard when the call @@ -514,7 +521,7 @@ public class KeyguardViewMediator extends SystemUI { @Override public boolean isScreenOn() { - return mScreenOn; + return mDeviceInteractive; } }; @@ -550,7 +557,7 @@ public class KeyguardViewMediator extends SystemUI { mViewMediatorCallback, mLockPatternUtils); final ContentResolver cr = mContext.getContentResolver(); - mScreenOn = mPM.isScreenOn(); + mDeviceInteractive = mPM.isInteractive(); mLockSounds = new SoundPool(1, AudioManager.STREAM_SYSTEM, 0); String soundPath = Settings.Global.getString(cr, Settings.Global.LOCK_SOUND); @@ -613,23 +620,18 @@ public class KeyguardViewMediator extends SystemUI { * @param why either {@link android.view.WindowManagerPolicy#OFF_BECAUSE_OF_USER} or * {@link android.view.WindowManagerPolicy#OFF_BECAUSE_OF_TIMEOUT}. */ - public void onScreenTurnedOff(int why) { + public void onStartedGoingToSleep(int why) { + if (DEBUG) Log.d(TAG, "onStartedGoingToSleep(" + why + ")"); synchronized (this) { - mScreenOn = false; - if (DEBUG) Log.d(TAG, "onScreenTurnedOff(" + why + ")"); - - resetKeyguardDonePendingLocked(); - mHideAnimationRun = false; + mDeviceInteractive = false; // Lock immediately based on setting if secure (user has a pin/pattern/password). // This also "locks" the device when not secure to provide easy access to the // camera while preventing unwanted input. int currentUser = KeyguardUpdateMonitor.getCurrentUser(); final boolean lockImmediately = - mLockPatternUtils.getPowerButtonInstantlyLocks(currentUser) - || !mLockPatternUtils.isSecure(currentUser); - - notifyScreenOffLocked(); + mLockPatternUtils.getPowerButtonInstantlyLocks(currentUser) + || !mLockPatternUtils.isSecure(currentUser); if (mExitSecureCallback != null) { if (DEBUG) Log.d(TAG, "pending exit secure callback cancelled"); @@ -643,12 +645,37 @@ public class KeyguardViewMediator extends SystemUI { hideLocked(); } } else if (mShowing) { - resetStateLocked(); + mPendingReset = true; } else if (why == WindowManagerPolicy.OFF_BECAUSE_OF_TIMEOUT - || (why == WindowManagerPolicy.OFF_BECAUSE_OF_USER && !lockImmediately)) { + || (why == WindowManagerPolicy.OFF_BECAUSE_OF_USER && !lockImmediately)) { doKeyguardLaterLocked(); - } else { + } else if (!mLockPatternUtils.isLockScreenDisabled(currentUser)) { + mPendingLock = true; + } + + if (mPendingLock || mPendingReset) { + playSounds(true); + } + } + } + + public void onFinishedGoingToSleep(int why) { + if (DEBUG) Log.d(TAG, "onFinishedGoingToSleep(" + why + ")"); + synchronized (this) { + mDeviceInteractive = false; + + resetKeyguardDonePendingLocked(); + mHideAnimationRun = false; + + notifyScreenOffLocked(); + + if (mPendingReset) { + resetStateLocked(); + mPendingReset = false; + } + if (mPendingLock) { doKeyguardLocked(null); + mPendingLock = false; } } KeyguardUpdateMonitor.getInstance(mContext).dispatchScreenTurnedOff(why); @@ -686,7 +713,6 @@ public class KeyguardViewMediator extends SystemUI { if (timeout <= 0) { // Lock now - mSuppressNextLockSound = true; doKeyguardLocked(null); } else { // Lock in the future @@ -706,13 +732,15 @@ public class KeyguardViewMediator extends SystemUI { } /** - * Let's us know the screen was turned on. + * Let's us know when the device is waking up. */ - public void onScreenTurnedOn(IKeyguardShowCallback callback) { + public void onStartedWakingUp(IKeyguardShowCallback callback) { + + // TODO: Rename all screen off/on references to interactive/sleeping synchronized (this) { - mScreenOn = true; + mDeviceInteractive = true; cancelDoKeyguardLaterLocked(); - if (DEBUG) Log.d(TAG, "onScreenTurnedOn, seq = " + mDelayedShowingSequence); + if (DEBUG) Log.d(TAG, "onStartedWakingUp, seq = " + mDelayedShowingSequence); if (callback != null) { notifyScreenOnLocked(callback); } @@ -737,7 +765,8 @@ public class KeyguardViewMediator extends SystemUI { */ public void onDreamingStarted() { synchronized (this) { - if (mScreenOn && mLockPatternUtils.isSecure(KeyguardUpdateMonitor.getCurrentUser())) { + if (mDeviceInteractive + && mLockPatternUtils.isSecure(KeyguardUpdateMonitor.getCurrentUser())) { doKeyguardLaterLocked(); } } @@ -748,7 +777,7 @@ public class KeyguardViewMediator extends SystemUI { */ public void onDreamingStopped() { synchronized (this) { - if (mScreenOn) { + if (mDeviceInteractive) { cancelDoKeyguardLaterLocked(); } } @@ -1100,8 +1129,6 @@ public class KeyguardViewMediator extends SystemUI { + sequence + ", mDelayedShowingSequence = " + mDelayedShowingSequence); synchronized (KeyguardViewMediator.this) { if (mDelayedShowingSequence == sequence) { - // Don't play lockscreen SFX if the screen went off due to timeout. - mSuppressNextLockSound = true; doKeyguardLocked(null); } } @@ -1252,13 +1279,6 @@ public class KeyguardViewMediator extends SystemUI { } private void playSounds(boolean locked) { - // User feedback for keyguard. - - if (mSuppressNextLockSound) { - mSuppressNextLockSound = false; - return; - } - playSound(locked ? mLockSoundId : mUnlockSoundId); } @@ -1283,9 +1303,6 @@ public class KeyguardViewMediator extends SystemUI { } private void playTrustedSound() { - if (mSuppressNextLockSound) { - return; - } playSound(mTrustedSoundId); } @@ -1318,9 +1335,6 @@ public class KeyguardViewMediator extends SystemUI { adjustStatusBarLocked(); userActivity(); - // Do this at the end to not slow down display of the keyguard. - playSounds(true); - mShowKeyguardWakeLock.release(); } mKeyguardDisplayManager.show(); diff --git a/packages/SystemUI/src/com/android/systemui/recents/Constants.java b/packages/SystemUI/src/com/android/systemui/recents/Constants.java index c7f891942968..18c213d8c5a2 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/Constants.java +++ b/packages/SystemUI/src/com/android/systemui/recents/Constants.java @@ -29,8 +29,6 @@ public class Constants { public static final boolean EnableTransitionThumbnailDebugMode = false; // Enables the filtering of tasks according to their grouping public static final boolean EnableTaskFiltering = false; - // Enables app-info pane on long-pressing the icon - public static final boolean EnableDevAppInfoOnLongPress = true; // Enables dismiss-all public static final boolean EnableDismissAll = false; // Enables debug mode diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java index 682775bb4928..01ed08a9d042 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java +++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java @@ -678,11 +678,7 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks, mHeaderView.mMoveTaskButton.setOnClickListener(this); } mActionButtonView.setOnClickListener(this); - if (Constants.DebugFlags.App.EnableDevAppInfoOnLongPress) { - if (mConfig.developerOptionsEnabled) { - mHeaderView.mApplicationIcon.setOnLongClickListener(this); - } - } + mHeaderView.mApplicationIcon.setOnLongClickListener(this); } mTaskDataLoaded = true; } @@ -701,9 +697,7 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks, mHeaderView.mMoveTaskButton.setOnClickListener(null); } mActionButtonView.setOnClickListener(null); - if (Constants.DebugFlags.App.EnableDevAppInfoOnLongPress) { - mHeaderView.mApplicationIcon.setOnLongClickListener(null); - } + mHeaderView.mApplicationIcon.setOnLongClickListener(null); } mTaskDataLoaded = false; } diff --git a/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java b/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java index 7e32c3a5a9f6..6d0236587e5b 100644 --- a/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java +++ b/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java @@ -60,6 +60,7 @@ import android.widget.ImageView; import com.android.systemui.R; import java.io.File; +import java.io.FileOutputStream; import java.io.OutputStream; import java.text.DateFormat; import java.text.SimpleDateFormat; @@ -232,6 +233,12 @@ class SaveImageInBackgroundTask extends AsyncTask<SaveImageInBackgroundData, Voi // for DATE_TAKEN long dateSeconds = mImageTime / 1000; + // Save + OutputStream out = new FileOutputStream(mImageFilePath); + image.compress(Bitmap.CompressFormat.PNG, 100, out); + out.flush(); + out.close(); + // Save the screenshot to the MediaStore ContentValues values = new ContentValues(); ContentResolver resolver = context.getContentResolver(); @@ -244,8 +251,10 @@ class SaveImageInBackgroundTask extends AsyncTask<SaveImageInBackgroundData, Voi values.put(MediaStore.Images.ImageColumns.MIME_TYPE, "image/png"); values.put(MediaStore.Images.ImageColumns.WIDTH, mImageWidth); values.put(MediaStore.Images.ImageColumns.HEIGHT, mImageHeight); + values.put(MediaStore.Images.ImageColumns.SIZE, new File(mImageFilePath).length()); Uri uri = resolver.insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values); + // Create a share intent String subjectDate = DateFormat.getDateTimeInstance().format(new Date(mImageTime)); String subject = String.format(SCREENSHOT_SHARE_SUBJECT_TEMPLATE, subjectDate); Intent sharingIntent = new Intent(Intent.ACTION_SEND); @@ -253,16 +262,6 @@ class SaveImageInBackgroundTask extends AsyncTask<SaveImageInBackgroundData, Voi sharingIntent.putExtra(Intent.EXTRA_STREAM, uri); sharingIntent.putExtra(Intent.EXTRA_SUBJECT, subject); - OutputStream out = resolver.openOutputStream(uri); - image.compress(Bitmap.CompressFormat.PNG, 100, out); - out.flush(); - out.close(); - - // Update file size in the database - values.clear(); - values.put(MediaStore.Images.ImageColumns.SIZE, new File(mImageFilePath).length()); - resolver.update(uri, values, null, null); - // Create a share action for the notification final PendingIntent callback = PendingIntent.getBroadcast(context, 0, new Intent(context, GlobalScreenshot.TargetChosenReceiver.class) diff --git a/services/core/java/com/android/server/ConnectivityService.java b/services/core/java/com/android/server/ConnectivityService.java index edca4b87842e..e5441128c1bb 100644 --- a/services/core/java/com/android/server/ConnectivityService.java +++ b/services/core/java/com/android/server/ConnectivityService.java @@ -4603,27 +4603,36 @@ public class ConnectivityService extends IConnectivityManager.Stub @Override public void factoryReset() { enforceConnectivityInternalPermission(); + + if (mUserManager.hasUserRestriction(UserManager.DISALLOW_NETWORK_RESET)) { + return; + } + final int userId = UserHandle.getCallingUserId(); // Turn airplane mode off setAirplaneMode(false); - // Untether - for (String tether : getTetheredIfaces()) { - untether(tether); + if (!mUserManager.hasUserRestriction(UserManager.DISALLOW_CONFIG_TETHERING)) { + // Untether + for (String tether : getTetheredIfaces()) { + untether(tether); + } } - // Turn VPN off - VpnConfig vpnConfig = getVpnConfig(userId); - if (vpnConfig != null) { - if (vpnConfig.legacy) { - prepareVpn(VpnConfig.LEGACY_VPN, VpnConfig.LEGACY_VPN, userId); - } else { - // Prevent this app (packagename = vpnConfig.user) from initiating VPN connections - // in the future without user intervention. - setVpnPackageAuthorization(vpnConfig.user, userId, false); + if (!mUserManager.hasUserRestriction(UserManager.DISALLOW_CONFIG_VPN)) { + // Turn VPN off + VpnConfig vpnConfig = getVpnConfig(userId); + if (vpnConfig != null) { + if (vpnConfig.legacy) { + prepareVpn(VpnConfig.LEGACY_VPN, VpnConfig.LEGACY_VPN, userId); + } else { + // Prevent this app (packagename = vpnConfig.user) from initiating VPN connections + // in the future without user intervention. + setVpnPackageAuthorization(vpnConfig.user, userId, false); - prepareVpn(vpnConfig.user, VpnConfig.LEGACY_VPN, userId); + prepareVpn(vpnConfig.user, VpnConfig.LEGACY_VPN, userId); + } } } } diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java index 706e9659bc5b..81b845712291 100644 --- a/services/core/java/com/android/server/am/ActivityManagerService.java +++ b/services/core/java/com/android/server/am/ActivityManagerService.java @@ -9028,11 +9028,22 @@ public final class ActivityManagerService extends ActivityManagerNative // Our work here is done. return; } + + final int callingUid = Binder.getCallingUid(); + final int lockTaskUid = lockTask.mLockTaskUid; // Ensure the same caller for startLockTaskMode and stopLockTaskMode. + // It is possible lockTaskMode was started by the system process because + // android:lockTaskMode is set to a locking value in the application manifest instead of + // the app calling startLockTaskMode. In this case {@link TaskRecord.mLockTaskUid} will + // be 0, so we compare the callingUid to the {@link TaskRecord.effectiveUid} instead. if (getLockTaskModeState() == ActivityManager.LOCK_TASK_MODE_LOCKED && - Binder.getCallingUid() != lockTask.mLockTaskUid) { - throw new SecurityException("Invalid uid, expected " + lockTask.mLockTaskUid); + callingUid != lockTaskUid + && (lockTaskUid != 0 + || (lockTaskUid == 0 && callingUid != lockTask.effectiveUid))) { + throw new SecurityException("Invalid uid, expected " + lockTaskUid + + " callingUid=" + callingUid + " effectiveUid=" + lockTask.effectiveUid); } + long ident = Binder.clearCallingIdentity(); try { Log.d(TAG, "stopLockTaskMode"); diff --git a/services/core/java/com/android/server/net/NetworkPolicyManagerService.java b/services/core/java/com/android/server/net/NetworkPolicyManagerService.java index 1a7956874a2e..792d4ba08b39 100644 --- a/services/core/java/com/android/server/net/NetworkPolicyManagerService.java +++ b/services/core/java/com/android/server/net/NetworkPolicyManagerService.java @@ -253,6 +253,7 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub private final INetworkManagementService mNetworkManager; private UsageStatsManagerInternal mUsageStats; private final TrustedTime mTime; + private final UserManager mUserManager; private IConnectivityManager mConnManager; private INotificationManager mNotifManager; @@ -336,6 +337,7 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub mDeviceIdleController = IDeviceIdleController.Stub.asInterface(ServiceManager.getService( DeviceIdleController.SERVICE_NAME)); mTime = checkNotNull(time, "missing TrustedTime"); + mUserManager = (UserManager) mContext.getSystemService(Context.USER_SERVICE); HandlerThread thread = new HandlerThread(TAG); thread.start(); @@ -1986,7 +1988,6 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub */ void updateRulesForGlobalChangeLocked(boolean restrictedNetworksChanged) { final PackageManager pm = mContext.getPackageManager(); - final UserManager um = (UserManager) mContext.getSystemService(Context.USER_SERVICE); // If we are in restrict power mode, we allow all important apps // to have data access. Otherwise, we restrict data access to only @@ -1996,7 +1997,7 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub : ActivityManager.PROCESS_STATE_TOP; // update rules for all installed applications - final List<UserInfo> users = um.getUsers(); + final List<UserInfo> users = mUserManager.getUsers(); final List<ApplicationInfo> apps = pm.getInstalledApplications( PackageManager.GET_UNINSTALLED_PACKAGES | PackageManager.GET_DISABLED_COMPONENTS); @@ -2353,6 +2354,10 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub public void factoryReset(String subscriber) { mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG); + if (mUserManager.hasUserRestriction(UserManager.DISALLOW_NETWORK_RESET)) { + return; + } + // Turn mobile data limit off NetworkPolicy[] policies = getNetworkPolicies(mContext.getOpPackageName()); NetworkTemplate template = NetworkTemplate.buildTemplateMobileAll(subscriber); @@ -2368,9 +2373,11 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub // Turn restrict background data off setRestrictBackground(false); - // Remove app's "restrict background data" flag - for (int uid : getUidsWithPolicy(POLICY_REJECT_METERED_BACKGROUND)) { - setUidPolicy(uid, POLICY_NONE); + if (!mUserManager.hasUserRestriction(UserManager.DISALLOW_APPS_CONTROL)) { + // Remove app's "restrict background data" flag + for (int uid : getUidsWithPolicy(POLICY_REJECT_METERED_BACKGROUND)) { + setUidPolicy(uid, POLICY_NONE); + } } } } diff --git a/services/core/java/com/android/server/pm/UserManagerService.java b/services/core/java/com/android/server/pm/UserManagerService.java index 15d1535a2eb1..08d386b4e699 100644 --- a/services/core/java/com/android/server/pm/UserManagerService.java +++ b/services/core/java/com/android/server/pm/UserManagerService.java @@ -950,6 +950,7 @@ public class UserManagerService extends IUserManager.Stub { writeBoolean(serializer, restrictions, UserManager.DISALLOW_DEBUGGING_FEATURES); writeBoolean(serializer, restrictions, UserManager.DISALLOW_CONFIG_VPN); writeBoolean(serializer, restrictions, UserManager.DISALLOW_CONFIG_TETHERING); + writeBoolean(serializer, restrictions, UserManager.DISALLOW_NETWORK_RESET); writeBoolean(serializer, restrictions, UserManager.DISALLOW_FACTORY_RESET); writeBoolean(serializer, restrictions, UserManager.DISALLOW_ADD_USER); writeBoolean(serializer, restrictions, UserManager.ENSURE_VERIFY_APPS); @@ -1078,6 +1079,7 @@ public class UserManagerService extends IUserManager.Stub { readBoolean(parser, restrictions, UserManager.DISALLOW_DEBUGGING_FEATURES); readBoolean(parser, restrictions, UserManager.DISALLOW_CONFIG_VPN); readBoolean(parser, restrictions, UserManager.DISALLOW_CONFIG_TETHERING); + readBoolean(parser, restrictions, UserManager.DISALLOW_NETWORK_RESET); readBoolean(parser, restrictions, UserManager.DISALLOW_FACTORY_RESET); readBoolean(parser, restrictions, UserManager.DISALLOW_ADD_USER); readBoolean(parser, restrictions, UserManager.ENSURE_VERIFY_APPS); diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java index 7d383fadabde..7bd5b7882962 100644 --- a/services/core/java/com/android/server/policy/PhoneWindowManager.java +++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java @@ -5269,6 +5269,9 @@ public class PhoneWindowManager implements WindowManagerPolicy { @Override public void startedGoingToSleep(int why) { if (DEBUG_WAKEUP) Slog.i(TAG, "Started going to sleep... (why=" + why + ")"); + if (mKeyguardDelegate != null) { + mKeyguardDelegate.onStartedGoingToSleep(why); + } } // Called on the PowerManager's Notifier thread. @@ -5286,9 +5289,8 @@ public class PhoneWindowManager implements WindowManagerPolicy { updateOrientationListenerLp(); updateLockScreenTimeout(); } - if (mKeyguardDelegate != null) { - mKeyguardDelegate.onScreenTurnedOff(why); + mKeyguardDelegate.onFinishedGoingToSleep(why); } } @@ -5316,7 +5318,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { } if (mKeyguardDelegate != null) { - mKeyguardDelegate.onScreenTurnedOn(mKeyguardDelegateCallback); + mKeyguardDelegate.onStartedWakingUp(mKeyguardDelegateCallback); // ... eventually calls finishKeyguardDrawn } else { if (DEBUG_WAKEUP) Slog.d(TAG, "null mKeyguardDelegate: setting mKeyguardDrawComplete."); diff --git a/services/core/java/com/android/server/policy/keyguard/KeyguardServiceDelegate.java b/services/core/java/com/android/server/policy/keyguard/KeyguardServiceDelegate.java index 1a52933056fa..b9f132bbc380 100644 --- a/services/core/java/com/android/server/policy/keyguard/KeyguardServiceDelegate.java +++ b/services/core/java/com/android/server/policy/keyguard/KeyguardServiceDelegate.java @@ -56,10 +56,8 @@ public class KeyguardServiceDelegate { boolean systemIsReady; boolean deviceHasKeyguard; public boolean enabled; - public boolean dismissable; public int offReason; public int currentUser; - public boolean screenIsOn; public boolean bootCompleted; }; @@ -138,7 +136,7 @@ public class KeyguardServiceDelegate { // If the system is ready, it means keyguard crashed and restarted. mKeyguardService.onSystemReady(); // This is used to hide the scrim once keyguard displays. - mKeyguardService.onScreenTurnedOn(new KeyguardShowDelegate( + mKeyguardService.onStartedWakingUp(new KeyguardShowDelegate( mShowListenerWhenConnect)); mShowListenerWhenConnect = null; } @@ -218,10 +216,10 @@ public class KeyguardServiceDelegate { mKeyguardState.dreaming = false; } - public void onScreenTurnedOn(final ShowListener showListener) { + public void onStartedWakingUp(final ShowListener showListener) { if (mKeyguardService != null) { if (DEBUG) Log.v(TAG, "onScreenTurnedOn(showListener = " + showListener + ")"); - mKeyguardService.onScreenTurnedOn(new KeyguardShowDelegate(showListener)); + mKeyguardService.onStartedWakingUp(new KeyguardShowDelegate(showListener)); } else { // try again when we establish a connection Slog.w(TAG, "onScreenTurnedOn(): no keyguard service!"); @@ -230,15 +228,19 @@ public class KeyguardServiceDelegate { mShowListenerWhenConnect = showListener; showScrim(); } - mKeyguardState.screenIsOn = true; } - public void onScreenTurnedOff(int why) { + public void onStartedGoingToSleep(int why) { if (mKeyguardService != null) { - mKeyguardService.onScreenTurnedOff(why); + mKeyguardService.onStartedGoingToSleep(why); } mKeyguardState.offReason = why; - mKeyguardState.screenIsOn = false; + } + + public void onFinishedGoingToSleep(int why) { + if (mKeyguardService != null) { + mKeyguardService.onFinishedGoingToSleep(why); + } } public void setKeyguardEnabled(boolean enabled) { diff --git a/services/core/java/com/android/server/policy/keyguard/KeyguardServiceWrapper.java b/services/core/java/com/android/server/policy/keyguard/KeyguardServiceWrapper.java index 2dc685b0633d..51d59fa4cb30 100644 --- a/services/core/java/com/android/server/policy/keyguard/KeyguardServiceWrapper.java +++ b/services/core/java/com/android/server/policy/keyguard/KeyguardServiceWrapper.java @@ -105,19 +105,28 @@ public class KeyguardServiceWrapper implements IKeyguardService { } } - @Override // Binder interface - public void onScreenTurnedOff(int reason) { + @Override + public void onStartedGoingToSleep(int reason) { try { - mService.onScreenTurnedOff(reason); + mService.onStartedGoingToSleep(reason); } catch (RemoteException e) { Slog.w(TAG , "Remote Exception", e); } } - @Override // Binder interface - public void onScreenTurnedOn(IKeyguardShowCallback result) { + @Override + public void onFinishedGoingToSleep(int reason) { + try { + mService.onFinishedGoingToSleep(reason); + } catch (RemoteException e) { + Slog.w(TAG , "Remote Exception", e); + } + } + + @Override + public void onStartedWakingUp(IKeyguardShowCallback callback) { try { - mService.onScreenTurnedOn(result); + mService.onStartedWakingUp(callback); } catch (RemoteException e) { Slog.w(TAG , "Remote Exception", e); } diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java index 7671293b8346..5c9f87e08f1a 100644 --- a/services/core/java/com/android/server/wm/WindowManagerService.java +++ b/services/core/java/com/android/server/wm/WindowManagerService.java @@ -741,8 +741,7 @@ public class WindowManagerService extends IWindowManager.Stub final float newX = motionEvent.getRawX(); final float newY = motionEvent.getRawY(); final boolean isStylusButtonDown = - (motionEvent.getToolType(0) == MotionEvent.TOOL_TYPE_STYLUS) - && (motionEvent.getButtonState() & MotionEvent.BUTTON_SECONDARY) != 0; + (motionEvent.getButtonState() & MotionEvent.BUTTON_STYLUS_PRIMARY) != 0; if (mIsStartEvent) { if (isStylusButtonDown) { diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java index d807b0b49364..ff748f23a48b 100644 --- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java @@ -202,6 +202,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { DEVICE_OWNER_USER_RESTRICTIONS = new HashSet(); DEVICE_OWNER_USER_RESTRICTIONS.add(UserManager.DISALLOW_USB_FILE_TRANSFER); DEVICE_OWNER_USER_RESTRICTIONS.add(UserManager.DISALLOW_CONFIG_TETHERING); + DEVICE_OWNER_USER_RESTRICTIONS.add(UserManager.DISALLOW_NETWORK_RESET); DEVICE_OWNER_USER_RESTRICTIONS.add(UserManager.DISALLOW_FACTORY_RESET); DEVICE_OWNER_USER_RESTRICTIONS.add(UserManager.DISALLOW_ADD_USER); DEVICE_OWNER_USER_RESTRICTIONS.add(UserManager.DISALLOW_CONFIG_CELL_BROADCASTS); diff --git a/telecomm/java/android/telecom/TelecomManager.java b/telecomm/java/android/telecom/TelecomManager.java index 4cf741d6c1b4..07176b3aa3af 100644 --- a/telecomm/java/android/telecom/TelecomManager.java +++ b/telecomm/java/android/telecom/TelecomManager.java @@ -124,6 +124,16 @@ public class TelecomManager { "android.telecom.action.CHANGE_DEFAULT_DIALER"; /** + * Privileged version of {@link #ACTION_CHANGE_DEFAULT_DIALER} that doesn't require + * confirmation from the user via the dialog. + * + * Requires permission: {@link android.Manifest.permission#MODIFY_PHONE_STATE} + * @hide + */ + public static final String ACTION_CHANGE_DEFAULT_DIALER_PRIVILEGED = + "android.telecom.action.CHANGE_DEFAULT_DIALER_PRIVILEGED"; + + /** * Activity action: Opens the settings screen where a user can enable and disable which * {@link PhoneAccount}s are allows to make and receive calls. Because a user must * explicitly enable an account before the system will use it, an app may want to send the |