[automerger skipped] DO NOT MERGE Refactor passwords/pins/patterns to byte[] am: 820b2504f3 -s ours am: 2d53e9d2ab
am: 3b960a8dea -s ours
am skip reason: subject contains skip directive
Change-Id: I1a64dc4665591e820915f2046a7e8da518f3503e
diff --git a/api/current.txt b/api/current.txt
index f78dfde..9776a11 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -11607,7 +11607,7 @@
method @NonNull public abstract java.util.List<android.content.pm.ResolveInfo> queryBroadcastReceivers(@NonNull android.content.Intent, int);
method @NonNull public abstract java.util.List<android.content.pm.ProviderInfo> queryContentProviders(@Nullable String, int, int);
method @NonNull public abstract java.util.List<android.content.pm.InstrumentationInfo> queryInstrumentation(@NonNull String, int);
- method @Nullable public abstract java.util.List<android.content.pm.ResolveInfo> queryIntentActivities(@NonNull android.content.Intent, int);
+ method @NonNull public abstract java.util.List<android.content.pm.ResolveInfo> queryIntentActivities(@NonNull android.content.Intent, int);
method @NonNull public abstract java.util.List<android.content.pm.ResolveInfo> queryIntentActivityOptions(@Nullable android.content.ComponentName, @Nullable android.content.Intent[], @NonNull android.content.Intent, int);
method @NonNull public abstract java.util.List<android.content.pm.ResolveInfo> queryIntentContentProviders(@NonNull android.content.Intent, int);
method @NonNull public abstract java.util.List<android.content.pm.ResolveInfo> queryIntentServices(@NonNull android.content.Intent, int);
diff --git a/core/java/android/app/ApplicationLoaders.java b/core/java/android/app/ApplicationLoaders.java
index faa30f3..2e59b90 100644
--- a/core/java/android/app/ApplicationLoaders.java
+++ b/core/java/android/app/ApplicationLoaders.java
@@ -145,8 +145,7 @@
*/
public void createAndCacheNonBootclasspathSystemClassLoaders(SharedLibraryInfo[] libs) {
if (mSystemLibsCacheMap != null) {
- Log.wtf(TAG, "Already cached.");
- return;
+ throw new IllegalStateException("Already cached.");
}
mSystemLibsCacheMap = new HashMap<String, CachedClassLoader>();
@@ -159,7 +158,8 @@
/**
* Caches a single non-bootclasspath class loader.
*
- * All of this library's dependencies must have previously been cached.
+ * All of this library's dependencies must have previously been cached. Otherwise, an exception
+ * is thrown.
*/
private void createAndCacheNonBootclasspathSystemClassLoader(SharedLibraryInfo lib) {
String path = lib.getPath();
@@ -174,9 +174,8 @@
CachedClassLoader cached = mSystemLibsCacheMap.get(dependencyPath);
if (cached == null) {
- Log.e(TAG, "Failed to find dependency " + dependencyPath
- + " of cached library " + path);
- return;
+ throw new IllegalStateException("Failed to find dependency " + dependencyPath
+ + " of cachedlibrary " + path);
}
sharedLibraries.add(cached.loader);
@@ -189,8 +188,8 @@
null /*cacheKey*/, null /*classLoaderName*/, sharedLibraries /*sharedLibraries*/);
if (classLoader == null) {
- Log.e(TAG, "Failed to cache " + path);
- return;
+ // bad configuration or break in classloading code
+ throw new IllegalStateException("Failed to cache " + path);
}
CachedClassLoader cached = new CachedClassLoader();
@@ -215,7 +214,7 @@
*
* If there is an error or the cache is not available, this returns null.
*/
- private ClassLoader getCachedNonBootclasspathSystemLib(String zip, ClassLoader parent,
+ public ClassLoader getCachedNonBootclasspathSystemLib(String zip, ClassLoader parent,
String classLoaderName, List<ClassLoader> sharedLibraries) {
if (mSystemLibsCacheMap == null) {
return null;
diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java
index f0539c49..025d8f9 100644
--- a/core/java/android/content/pm/PackageManager.java
+++ b/core/java/android/content/pm/PackageManager.java
@@ -4423,7 +4423,7 @@
* {@link #resolveActivity}. If there are no matching activities, an
* empty list is returned.
*/
- @Nullable
+ @NonNull
public abstract List<ResolveInfo> queryIntentActivities(@NonNull Intent intent,
@ResolveInfoFlags int flags);
@@ -4444,7 +4444,7 @@
* empty list is returned.
* @hide
*/
- @Nullable
+ @NonNull
@UnsupportedAppUsage
public abstract List<ResolveInfo> queryIntentActivitiesAsUser(@NonNull Intent intent,
@ResolveInfoFlags int flags, @UserIdInt int userId);
diff --git a/core/java/android/hardware/Camera.java b/core/java/android/hardware/Camera.java
index 81abdea0..10fe52a 100644
--- a/core/java/android/hardware/Camera.java
+++ b/core/java/android/hardware/Camera.java
@@ -812,7 +812,10 @@
*
* @throws RuntimeException if starting preview fails; usually this would be
* because of a hardware or other low-level error, or because release()
- * has been called on this Camera instance.
+ * has been called on this Camera instance. The QCIF (176x144) exception
+ * mentioned in {@link Parameters#setPreviewSize setPreviewSize} and
+ * {@link Parameters#setPictureSize setPictureSize} can also cause this
+ * exception be thrown.
*/
public native final void startPreview();
@@ -2863,6 +2866,16 @@
* orientation should also be considered while setting picture size and
* thumbnail size.
*
+ * Exception on 176x144 (QCIF) resolution:
+ * Camera devices usually have a fixed capability for downscaling from
+ * larger resolution to smaller, and the QCIF resolution sometimes
+ * is not fully supported due to this limitation on devices with
+ * high-resolution image sensors. Therefore, trying to configure a QCIF
+ * preview size with any picture or video size larger than 1920x1080
+ * (either width or height) might not be supported, and
+ * {@link #setParameters(Camera.Parameters)} might throw a
+ * RuntimeException if it is not.
+ *
* @param width the width of the pictures, in pixels
* @param height the height of the pictures, in pixels
* @see #setDisplayOrientation(int)
@@ -2908,6 +2921,16 @@
* preview can be different from the resolution of the recorded video
* during video recording.</p>
*
+ * <p>Exception on 176x144 (QCIF) resolution:
+ * Camera devices usually have a fixed capability for downscaling from
+ * larger resolution to smaller, and the QCIF resolution sometimes
+ * is not fully supported due to this limitation on devices with
+ * high-resolution image sensors. Therefore, trying to configure a QCIF
+ * video resolution with any preview or picture size larger than
+ * 1920x1080 (either width or height) might not be supported, and
+ * {@link #setParameters(Camera.Parameters)} will throw a
+ * RuntimeException if it is not.</p>
+ *
* @return a list of Size object if camera has separate preview and
* video output; otherwise, null is returned.
* @see #getPreferredPreviewSizeForVideo()
@@ -3202,6 +3225,16 @@
* <p>Applications need to consider the display orientation. See {@link
* #setPreviewSize(int,int)} for reference.</p>
*
+ * <p>Exception on 176x144 (QCIF) resolution:
+ * Camera devices usually have a fixed capability for downscaling from
+ * larger resolution to smaller, and the QCIF resolution sometimes
+ * is not fully supported due to this limitation on devices with
+ * high-resolution image sensors. Therefore, trying to configure a QCIF
+ * picture size with any preview or video size larger than 1920x1080
+ * (either width or height) might not be supported, and
+ * {@link #setParameters(Camera.Parameters)} might throw a
+ * RuntimeException if it is not.</p>
+ *
* @param width the width for pictures, in pixels
* @param height the height for pictures, in pixels
* @see #setPreviewSize(int,int)
diff --git a/core/java/android/hardware/camera2/CameraCharacteristics.java b/core/java/android/hardware/camera2/CameraCharacteristics.java
index 6a2d8d8..48588e6 100644
--- a/core/java/android/hardware/camera2/CameraCharacteristics.java
+++ b/core/java/android/hardware/camera2/CameraCharacteristics.java
@@ -2396,6 +2396,12 @@
* </table>
* <p>Refer to {@link CameraCharacteristics#REQUEST_AVAILABLE_CAPABILITIES android.request.availableCapabilities} for additional
* mandatory stream configurations on a per-capability basis.</p>
+ * <p>Exception on 176x144 (QCIF) resolution: camera devices usually have a fixed capability for
+ * downscaling from larger resolution to smaller, and the QCIF resolution sometimes is not
+ * fully supported due to this limitation on devices with high-resolution image sensors.
+ * Therefore, trying to configure a QCIF resolution stream together with any other
+ * stream larger than 1920x1080 resolution (either width or height) might not be supported,
+ * and capture session creation will fail if it is not.</p>
* <p>This key is available on all devices.</p>
*
* @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
@@ -2592,6 +2598,12 @@
* ratio 4:3, and the JPEG encoder alignment requirement is 16, the maximum JPEG size will be
* 3264x2448.</li>
* </ul>
+ * <p>Exception on 176x144 (QCIF) resolution: camera devices usually have a fixed capability on
+ * downscaling from larger resolution to smaller ones, and the QCIF resolution can sometimes
+ * not be fully supported due to this limitation on devices with high-resolution image
+ * sensors. Therefore, trying to configure a QCIF resolution stream together with any other
+ * stream larger than 1920x1080 resolution (either width or height) might not be supported,
+ * and capture session creation will fail if it is not.</p>
* <p>This key is available on all devices.</p>
*
* @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
@@ -3580,7 +3592,7 @@
* <li><code>LEVEL_3</code> devices additionally support YUV reprocessing and RAW image capture, along
* with additional output stream configurations.</li>
* <li><code>EXTERNAL</code> devices are similar to <code>LIMITED</code> devices with exceptions like some sensor or
- * lens information not reorted or less stable framerates.</li>
+ * lens information not reported or less stable framerates.</li>
* </ul>
* <p>See the individual level enums for full descriptions of the supported capabilities. The
* {@link CameraCharacteristics#REQUEST_AVAILABLE_CAPABILITIES android.request.availableCapabilities} entry describes the device's capabilities at a
diff --git a/core/java/android/hardware/camera2/CameraDevice.java b/core/java/android/hardware/camera2/CameraDevice.java
index 20fc53f..bac6522 100644
--- a/core/java/android/hardware/camera2/CameraDevice.java
+++ b/core/java/android/hardware/camera2/CameraDevice.java
@@ -449,6 +449,14 @@
* by calling {@link #isSessionConfigurationSupported} or attempting to create a session with
* such targets.</p>
*
+ * <p>Exception on 176x144 (QCIF) resolution:
+ * Camera devices usually have a fixed capability for downscaling from larger resolution to
+ * smaller, and the QCIF resolution sometimes is not fully supported due to this
+ * limitation on devices with high-resolution image sensors. Therefore, trying to configure a
+ * QCIF resolution stream together with any other stream larger than 1920x1080 resolution
+ * (either width or height) might not be supported, and capture session creation will fail if it
+ * is not.</p>
+ *
* @param outputs The new set of Surfaces that should be made available as
* targets for captured image data.
* @param callback The callback to notify about the status of the new capture session.
diff --git a/core/java/android/hardware/display/ColorDisplayManager.java b/core/java/android/hardware/display/ColorDisplayManager.java
index 0c07a67..ce71db6 100644
--- a/core/java/android/hardware/display/ColorDisplayManager.java
+++ b/core/java/android/hardware/display/ColorDisplayManager.java
@@ -392,6 +392,26 @@
}
/**
+ * Enables or disables display white balance.
+ *
+ * @hide
+ */
+ @RequiresPermission(android.Manifest.permission.CONTROL_DISPLAY_COLOR_TRANSFORMS)
+ public boolean setDisplayWhiteBalanceEnabled(boolean enabled) {
+ return mManager.setDisplayWhiteBalanceEnabled(enabled);
+ }
+
+ /**
+ * Returns whether display white balance is currently enabled. Even if enabled, it may or may
+ * not be active, if another transform with higher priority is active.
+ *
+ * @hide
+ */
+ public boolean isDisplayWhiteBalanceEnabled() {
+ return mManager.isDisplayWhiteBalanceEnabled();
+ }
+
+ /**
* Returns {@code true} if Night Display is supported by the device.
*
* @hide
@@ -616,6 +636,22 @@
}
}
+ boolean isDisplayWhiteBalanceEnabled() {
+ try {
+ return mCdm.isDisplayWhiteBalanceEnabled();
+ } catch (RemoteException e) {
+ throw e.rethrowFromSystemServer();
+ }
+ }
+
+ boolean setDisplayWhiteBalanceEnabled(boolean enabled) {
+ try {
+ return mCdm.setDisplayWhiteBalanceEnabled(enabled);
+ } catch (RemoteException e) {
+ throw e.rethrowFromSystemServer();
+ }
+ }
+
int getColorMode() {
try {
return mCdm.getColorMode();
diff --git a/core/java/android/hardware/display/IColorDisplayManager.aidl b/core/java/android/hardware/display/IColorDisplayManager.aidl
index 88b59a6..7b1033d 100644
--- a/core/java/android/hardware/display/IColorDisplayManager.aidl
+++ b/core/java/android/hardware/display/IColorDisplayManager.aidl
@@ -42,4 +42,7 @@
int getColorMode();
void setColorMode(int colorMode);
+
+ boolean isDisplayWhiteBalanceEnabled();
+ boolean setDisplayWhiteBalanceEnabled(boolean enabled);
}
\ No newline at end of file
diff --git a/core/java/android/os/BatteryStats.java b/core/java/android/os/BatteryStats.java
index 00d522b..ecd16dd 100644
--- a/core/java/android/os/BatteryStats.java
+++ b/core/java/android/os/BatteryStats.java
@@ -266,8 +266,11 @@
* - Fixed bug in min learned capacity updating process.
* New in version 34:
* - Deprecated STATS_SINCE_UNPLUGGED and STATS_CURRENT.
+ * New in version 35:
+ * - Fixed bug that was not reporting high cellular tx power correctly
+ * - Added out of service and emergency service modes to data connection types
*/
- static final int CHECKIN_VERSION = 34;
+ static final int CHECKIN_VERSION = 35;
/**
* Old version, we hit 9 and ran out of room, need to remove.
@@ -2371,18 +2374,21 @@
*/
public abstract int getMobileRadioActiveUnknownCount(int which);
- public static final int DATA_CONNECTION_NONE = 0;
- public static final int DATA_CONNECTION_OTHER = TelephonyManager.MAX_NETWORK_TYPE + 1;
+ public static final int DATA_CONNECTION_OUT_OF_SERVICE = 0;
+ public static final int DATA_CONNECTION_EMERGENCY_SERVICE =
+ TelephonyManager.MAX_NETWORK_TYPE + 1;
+ public static final int DATA_CONNECTION_OTHER = DATA_CONNECTION_EMERGENCY_SERVICE + 1;
+
static final String[] DATA_CONNECTION_NAMES = {
- "none", "gprs", "edge", "umts", "cdma", "evdo_0", "evdo_A",
+ "oos", "gprs", "edge", "umts", "cdma", "evdo_0", "evdo_A",
"1xrtt", "hsdpa", "hsupa", "hspa", "iden", "evdo_b", "lte",
"ehrpd", "hspap", "gsm", "td_scdma", "iwlan", "lte_ca", "nr",
- "other"
+ "emngcy", "other"
};
@UnsupportedAppUsage
- public static final int NUM_DATA_CONNECTION_TYPES = DATA_CONNECTION_OTHER+1;
+ public static final int NUM_DATA_CONNECTION_TYPES = DATA_CONNECTION_OTHER + 1;
/**
* Returns the time in microseconds that the phone has been running with
@@ -6564,6 +6570,10 @@
}
oldState = rec.states;
oldState2 = rec.states2;
+ // Clear High Tx Power Flag for volta positioning
+ if ((rec.states2 & HistoryItem.STATE2_CELLULAR_HIGH_TX_POWER_FLAG) != 0) {
+ rec.states2 &= ~HistoryItem.STATE2_CELLULAR_HIGH_TX_POWER_FLAG;
+ }
}
return item.toString();
@@ -7865,9 +7875,9 @@
// Phone data connection (DATA_CONNECTION_TIME_DATA and DATA_CONNECTION_COUNT_DATA)
for (int i = 0; i < NUM_DATA_CONNECTION_TYPES; ++i) {
// Map OTHER to TelephonyManager.NETWORK_TYPE_UNKNOWN and mark NONE as a boolean.
- boolean isNone = (i == DATA_CONNECTION_NONE);
+ boolean isNone = (i == DATA_CONNECTION_OUT_OF_SERVICE);
int telephonyNetworkType = i;
- if (i == DATA_CONNECTION_OTHER) {
+ if (i == DATA_CONNECTION_OTHER || i == DATA_CONNECTION_EMERGENCY_SERVICE) {
telephonyNetworkType = TelephonyManager.NETWORK_TYPE_UNKNOWN;
}
final long pdcToken = proto.start(SystemProto.DATA_CONNECTION);
diff --git a/core/java/android/view/WindowManager.java b/core/java/android/view/WindowManager.java
index bd38327..c2aec6a 100644
--- a/core/java/android/view/WindowManager.java
+++ b/core/java/android/view/WindowManager.java
@@ -1746,7 +1746,7 @@
* what the other flags are.
* @hide
*/
- public static final int PRIVATE_FLAG_FORCE_DRAW_STATUS_BAR_BACKGROUND = 0x00020000;
+ public static final int PRIVATE_FLAG_FORCE_DRAW_BAR_BACKGROUNDS = 0x00020000;
/**
* Flag to indicate that this window needs Sustained Performance Mode if
@@ -1877,8 +1877,8 @@
equals = PRIVATE_FLAG_LAYOUT_CHILD_WINDOW_IN_PARENT_FRAME,
name = "LAYOUT_CHILD_WINDOW_IN_PARENT_FRAME"),
@ViewDebug.FlagToString(
- mask = PRIVATE_FLAG_FORCE_DRAW_STATUS_BAR_BACKGROUND,
- equals = PRIVATE_FLAG_FORCE_DRAW_STATUS_BAR_BACKGROUND,
+ mask = PRIVATE_FLAG_FORCE_DRAW_BAR_BACKGROUNDS,
+ equals = PRIVATE_FLAG_FORCE_DRAW_BAR_BACKGROUNDS,
name = "FORCE_DRAW_STATUS_BAR_BACKGROUND"),
@ViewDebug.FlagToString(
mask = PRIVATE_FLAG_SUSTAINED_PERFORMANCE_MODE,
diff --git a/core/java/com/android/internal/app/IBatteryStats.aidl b/core/java/com/android/internal/app/IBatteryStats.aidl
index 114d31f..9f860e2 100644
--- a/core/java/com/android/internal/app/IBatteryStats.aidl
+++ b/core/java/com/android/internal/app/IBatteryStats.aidl
@@ -106,7 +106,7 @@
void notePhoneOn();
void notePhoneOff();
void notePhoneSignalStrength(in SignalStrength signalStrength);
- void notePhoneDataConnectionState(int dataType, boolean hasData);
+ void notePhoneDataConnectionState(int dataType, boolean hasData, int serviceType);
void notePhoneState(int phoneState);
void noteWifiOn();
void noteWifiOff();
diff --git a/core/java/com/android/internal/os/BatteryStatsImpl.java b/core/java/com/android/internal/os/BatteryStatsImpl.java
index 1fc7635..8f37d81 100644
--- a/core/java/com/android/internal/os/BatteryStatsImpl.java
+++ b/core/java/com/android/internal/os/BatteryStatsImpl.java
@@ -907,8 +907,6 @@
@VisibleForTesting(visibility = VisibleForTesting.Visibility.PACKAGE)
protected StopwatchTimer mBluetoothScanTimer;
- boolean mIsCellularTxPowerHigh = false;
-
int mMobileRadioPowerState = DataConnectionRealTimeInfo.DC_POWER_STATE_LOW;
long mMobileRadioActiveStartTime;
StopwatchTimer mMobileRadioActiveTimer;
@@ -5275,16 +5273,26 @@
}
@UnsupportedAppUsage
- public void notePhoneDataConnectionStateLocked(int dataType, boolean hasData) {
+ public void notePhoneDataConnectionStateLocked(int dataType, boolean hasData, int serviceType) {
// BatteryStats uses 0 to represent no network type.
// Telephony does not have a concept of no network type, and uses 0 to represent unknown.
// Unknown is included in DATA_CONNECTION_OTHER.
- int bin = DATA_CONNECTION_NONE;
+ int bin = DATA_CONNECTION_OUT_OF_SERVICE;
if (hasData) {
if (dataType > 0 && dataType <= TelephonyManager.MAX_NETWORK_TYPE) {
bin = dataType;
} else {
- bin = DATA_CONNECTION_OTHER;
+ switch (serviceType) {
+ case ServiceState.STATE_OUT_OF_SERVICE:
+ bin = DATA_CONNECTION_OUT_OF_SERVICE;
+ break;
+ case ServiceState.STATE_EMERGENCY_ONLY:
+ bin = DATA_CONNECTION_EMERGENCY_SERVICE;
+ break;
+ default:
+ bin = DATA_CONNECTION_OTHER;
+ break;
+ }
}
}
if (DEBUG) Log.i(TAG, "Phone Data Connection -> " + dataType + " = " + hasData);
@@ -11198,19 +11206,9 @@
}
}
if (levelMaxTimeSpent == ModemActivityInfo.TX_POWER_LEVELS - 1) {
- if (!mIsCellularTxPowerHigh) {
- mHistoryCur.states2 |= HistoryItem.STATE2_CELLULAR_HIGH_TX_POWER_FLAG;
- addHistoryRecordLocked(elapsedRealtime, uptime);
- mIsCellularTxPowerHigh = true;
- }
- return;
- }
- if (mIsCellularTxPowerHigh) {
- mHistoryCur.states2 &= ~HistoryItem.STATE2_CELLULAR_HIGH_TX_POWER_FLAG;
+ mHistoryCur.states2 |= HistoryItem.STATE2_CELLULAR_HIGH_TX_POWER_FLAG;
addHistoryRecordLocked(elapsedRealtime, uptime);
- mIsCellularTxPowerHigh = false;
}
- return;
}
private final class BluetoothActivityInfoCache {
@@ -13670,7 +13668,6 @@
mCameraOnTimer.readSummaryFromParcelLocked(in);
mBluetoothScanNesting = 0;
mBluetoothScanTimer.readSummaryFromParcelLocked(in);
- mIsCellularTxPowerHigh = false;
int NRPMS = in.readInt();
if (NRPMS > 10000) {
@@ -14654,7 +14651,6 @@
mCameraOnTimer = new StopwatchTimer(mClocks, null, -13, null, mOnBatteryTimeBase, in);
mBluetoothScanNesting = 0;
mBluetoothScanTimer = new StopwatchTimer(mClocks, null, -14, null, mOnBatteryTimeBase, in);
- mIsCellularTxPowerHigh = false;
mDischargeUnplugLevel = in.readInt();
mDischargePlugLevel = in.readInt();
mDischargeCurrentLevel = in.readInt();
diff --git a/core/java/com/android/internal/policy/DecorView.java b/core/java/com/android/internal/policy/DecorView.java
index 625814d..66a6329 100644
--- a/core/java/com/android/internal/policy/DecorView.java
+++ b/core/java/com/android/internal/policy/DecorView.java
@@ -38,7 +38,6 @@
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION;
import static android.view.WindowManager.LayoutParams.TYPE_BASE_APPLICATION;
import static android.view.WindowManager.LayoutParams.TYPE_DRAWN_APPLICATION;
-
import static com.android.internal.policy.PhoneWindow.FEATURE_OPTIONS_PANEL;
import android.animation.Animator;
@@ -53,6 +52,7 @@
import android.content.res.Resources;
import android.graphics.Canvas;
import android.graphics.Color;
+import android.graphics.Insets;
import android.graphics.LinearGradient;
import android.graphics.Outline;
import android.graphics.Paint;
@@ -205,8 +205,8 @@
private final Interpolator mShowInterpolator;
private final Interpolator mHideInterpolator;
private final int mBarEnterExitDuration;
- final boolean mForceWindowDrawsStatusBarBackground;
- private final int mSemiTransparentStatusBarColor;
+ final boolean mForceWindowDrawsBarBackgrounds;
+ private final int mSemiTransparentBarColor;
private final BackgroundFallback mBackgroundFallback = new BackgroundFallback();
@@ -242,6 +242,8 @@
private boolean mWindowResizeCallbacksAdded = false;
private Drawable.Callback mLastBackgroundDrawableCb = null;
private BackdropFrameRenderer mBackdropFrameRenderer = null;
+ private Drawable mOriginalBackgroundDrawable;
+ private Drawable mLastOriginalBackgroundDrawable;
private Drawable mResizingBackgroundDrawable;
private Drawable mCaptionBackgroundDrawable;
private Drawable mUserCaptionBackgroundDrawable;
@@ -257,6 +259,8 @@
private final int mResizeShadowSize;
private final Paint mVerticalResizeShadowPaint = new Paint();
private final Paint mHorizontalResizeShadowPaint = new Paint();
+ private Insets mBackgroundInsets = Insets.NONE;
+ private Insets mLastBackgroundInsets = Insets.NONE;
DecorView(Context context, int featureId, PhoneWindow window,
WindowManager.LayoutParams params) {
@@ -270,10 +274,10 @@
mBarEnterExitDuration = context.getResources().getInteger(
R.integer.dock_enter_exit_duration);
- mForceWindowDrawsStatusBarBackground = context.getResources().getBoolean(
+ mForceWindowDrawsBarBackgrounds = context.getResources().getBoolean(
R.bool.config_forceWindowDrawsStatusBarBackground)
&& context.getApplicationInfo().targetSdkVersion >= N;
- mSemiTransparentStatusBarColor = context.getResources().getColor(
+ mSemiTransparentBarColor = context.getResources().getColor(
R.color.system_bar_background_semi_transparent, null /* theme */);
updateAvailableWidth();
@@ -948,8 +952,9 @@
}
public void setWindowBackground(Drawable drawable) {
- if (getBackground() != drawable) {
- setBackgroundDrawable(drawable);
+ if (mOriginalBackgroundDrawable != drawable) {
+ mOriginalBackgroundDrawable = drawable;
+ updateBackgroundDrawable();
if (drawable != null) {
mResizingBackgroundDrawable = enforceNonTranslucentBackground(drawable,
mWindow.isTranslucent() || mWindow.isShowingWallpaper());
@@ -1114,9 +1119,10 @@
boolean navBarToLeftEdge = isNavBarToLeftEdge(mLastBottomInset, mLastLeftInset);
int navBarSize = getNavBarSize(mLastBottomInset, mLastRightInset, mLastLeftInset);
updateColorViewInt(mNavigationColorViewState, sysUiVisibility,
- mWindow.mNavigationBarColor, mWindow.mNavigationBarDividerColor, navBarSize,
+ calculateNavigationBarColor(), mWindow.mNavigationBarDividerColor, navBarSize,
navBarToRightEdge || navBarToLeftEdge, navBarToLeftEdge,
- 0 /* sideInset */, animate && !disallowAnimate, false /* force */);
+ 0 /* sideInset */, animate && !disallowAnimate,
+ mForceWindowDrawsBarBackgrounds);
boolean statusBarNeedsRightInset = navBarToRightEdge
&& mNavigationColorViewState.present;
@@ -1128,24 +1134,34 @@
calculateStatusBarColor(), 0, mLastTopInset,
false /* matchVertical */, statusBarNeedsLeftInset, statusBarSideInset,
animate && !disallowAnimate,
- mForceWindowDrawsStatusBarBackground);
+ mForceWindowDrawsBarBackgrounds);
}
- // When we expand the window with FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS, we still need
- // to ensure that the rest of the view hierarchy doesn't notice it, unless they've
- // explicitly asked for it.
- boolean consumingNavBar =
- (attrs.flags & FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) != 0
+ // When we expand the window with FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS or
+ // mForceWindowDrawsBarBackgrounds, we still need to ensure that the rest of the view
+ // hierarchy doesn't notice it, unless they've explicitly asked for it.
+ //
+ // Note: We don't need to check for IN_SCREEN or INSET_DECOR because unlike the status bar,
+ // these flags wouldn't make the window draw behind the navigation bar, unless
+ // LAYOUT_HIDE_NAVIGATION was set.
+ boolean forceConsumingNavBar = (mForceWindowDrawsBarBackgrounds
+ && (attrs.flags & FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) == 0
&& (sysUiVisibility & SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION) == 0
- && (sysUiVisibility & SYSTEM_UI_FLAG_HIDE_NAVIGATION) == 0
+ && (sysUiVisibility & SYSTEM_UI_FLAG_HIDE_NAVIGATION) == 0)
|| mLastShouldAlwaysConsumeSystemBars;
+ boolean consumingNavBar =
+ ((attrs.flags & FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) != 0
+ && (sysUiVisibility & SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION) == 0
+ && (sysUiVisibility & SYSTEM_UI_FLAG_HIDE_NAVIGATION) == 0)
+ || forceConsumingNavBar;
+
// If we didn't request fullscreen layout, but we still got it because of the
- // mForceWindowDrawsStatusBarBackground flag, also consume top inset.
+ // mForceWindowDrawsBarBackgrounds flag, also consume top inset.
boolean consumingStatusBar = (sysUiVisibility & SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN) == 0
&& (attrs.flags & FLAG_LAYOUT_IN_SCREEN) == 0
&& (attrs.flags & FLAG_LAYOUT_INSET_DECOR) == 0
- && mForceWindowDrawsStatusBarBackground
+ && mForceWindowDrawsBarBackgrounds
&& mLastTopInset != 0
|| mLastShouldAlwaysConsumeSystemBars;
@@ -1176,21 +1192,63 @@
}
}
+ if (forceConsumingNavBar) {
+ mBackgroundInsets = Insets.of(mLastLeftInset, 0, mLastRightInset, mLastBottomInset);
+ } else {
+ mBackgroundInsets = Insets.NONE;
+ }
+ updateBackgroundDrawable();
+
if (insets != null) {
insets = insets.consumeStableInsets();
}
return insets;
}
- private int calculateStatusBarColor() {
- return calculateStatusBarColor(mWindow.getAttributes().flags,
- mSemiTransparentStatusBarColor, mWindow.mStatusBarColor);
+ /**
+ * Updates the background drawable, applying padding to it in case we {@link #mBackgroundInsets}
+ * are set.
+ */
+ private void updateBackgroundDrawable() {
+ if (mBackgroundInsets.equals(mLastBackgroundInsets)
+ && mLastOriginalBackgroundDrawable == mOriginalBackgroundDrawable) {
+ return;
+ }
+ if (mBackgroundInsets.equals(Insets.NONE)) {
+ setBackground(mOriginalBackgroundDrawable);
+ } else {
+ setBackground(new InsetDrawable(mOriginalBackgroundDrawable,
+ mBackgroundInsets.left, mBackgroundInsets.top,
+ mBackgroundInsets.right, mBackgroundInsets.bottom) {
+
+ /**
+ * Return inner padding so we don't apply the padding again in
+ * {@link DecorView#drawableChanged()}
+ */
+ @Override
+ public boolean getPadding(Rect padding) {
+ return getDrawable().getPadding(padding);
+ }
+ });
+ }
+ mLastBackgroundInsets = mBackgroundInsets;
+ mLastOriginalBackgroundDrawable = mOriginalBackgroundDrawable;
}
- public static int calculateStatusBarColor(int flags, int semiTransparentStatusBarColor,
- int statusBarColor) {
- return (flags & FLAG_TRANSLUCENT_STATUS) != 0 ? semiTransparentStatusBarColor
- : (flags & FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) != 0 ? statusBarColor
+ private int calculateStatusBarColor() {
+ return calculateBarColor(mWindow.getAttributes().flags, FLAG_TRANSLUCENT_STATUS,
+ mSemiTransparentBarColor, mWindow.mStatusBarColor);
+ }
+
+ private int calculateNavigationBarColor() {
+ return calculateBarColor(mWindow.getAttributes().flags, FLAG_TRANSLUCENT_NAVIGATION,
+ mSemiTransparentBarColor, mWindow.mNavigationBarColor);
+ }
+
+ public static int calculateBarColor(int flags, int translucentFlag, int semiTransparentBarColor,
+ int barColor) {
+ return (flags & translucentFlag) != 0 ? semiTransparentBarColor
+ : (flags & FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) != 0 ? barColor
: Color.BLACK;
}
diff --git a/core/java/com/android/internal/policy/PhoneWindow.java b/core/java/com/android/internal/policy/PhoneWindow.java
index 890ee86..04559e4 100644
--- a/core/java/com/android/internal/policy/PhoneWindow.java
+++ b/core/java/com/android/internal/policy/PhoneWindow.java
@@ -31,7 +31,7 @@
import static android.view.WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS;
import static android.view.WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT;
import static android.view.WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_NEVER;
-import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_FORCE_DRAW_STATUS_BAR_BACKGROUND;
+import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_FORCE_DRAW_BAR_BACKGROUNDS;
import android.annotation.NonNull;
import android.annotation.UnsupportedAppUsage;
@@ -2469,8 +2469,8 @@
setFlags(FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS,
FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS & ~getForcedWindowFlags());
}
- if (mDecor.mForceWindowDrawsStatusBarBackground) {
- params.privateFlags |= PRIVATE_FLAG_FORCE_DRAW_STATUS_BAR_BACKGROUND;
+ if (mDecor.mForceWindowDrawsBarBackgrounds) {
+ params.privateFlags |= PRIVATE_FLAG_FORCE_DRAW_BAR_BACKGROUNDS;
}
}
if (a.getBoolean(R.styleable.Window_windowLightStatusBar, false)) {
diff --git a/core/res/Android.bp b/core/res/Android.bp
index e66f1a2..4e60f8c 100644
--- a/core/res/Android.bp
+++ b/core/res/Android.bp
@@ -39,3 +39,12 @@
// PRODUCT-agnostic resource data like IDs and type definitions.
export_package_resources: true,
}
+
+// This logic can be removed once robolectric's transition to binary resources is complete
+filegroup {
+ name: "robolectric_framework_raw_res_files",
+ srcs: [
+ "assets/**/*",
+ "res/**/*",
+ ],
+}
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index ec2a6ae..21f5acb 100644
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -1302,12 +1302,6 @@
<!-- Disable lockscreen rotation by default -->
<bool name="config_enableLockScreenRotation">false</bool>
- <!-- Enable lockscreen translucent decor by default -->
- <bool name="config_enableLockScreenTranslucentDecor">true</bool>
-
- <!-- Enable translucent decor by default -->
- <bool name="config_enableTranslucentDecor">true</bool>
-
<!-- Is the device capable of hot swapping an UICC Card -->
<bool name="config_hotswapCapable">false</bool>
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index 4b8a96c..6f3adfd 100644
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -1434,7 +1434,7 @@
<string name="permdesc_mediaLocation">Allows the app to read locations from your media collection.</string>
<!-- Title shown when the system-provided biometric dialog is shown, asking the user to authenticate. [CHAR LIMIT=40] -->
- <string name="biometric_dialog_default_title">Application <xliff:g id="app" example="Gmail">%s</xliff:g> wants to authenticate.</string>
+ <string name="biometric_dialog_default_title">Verify it\u2018s you</string>
<!-- Message shown when biometric hardware is not available [CHAR LIMIT=50] -->
<string name="biometric_error_hw_unavailable">Biometric hardware unavailable</string>
<!-- Message shown when biometric authentication was canceled by the user [CHAR LIMIT=50] -->
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index 3e23640..fb7be77 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -1717,8 +1717,6 @@
<java-symbol type="bool" name="config_enableCarDockHomeLaunch" />
<java-symbol type="bool" name="config_enableLockBeforeUnlockScreen" />
<java-symbol type="bool" name="config_enableLockScreenRotation" />
- <java-symbol type="bool" name="config_enableLockScreenTranslucentDecor" />
- <java-symbol type="bool" name="config_enableTranslucentDecor" />
<java-symbol type="bool" name="config_forceShowSystemBars" />
<java-symbol type="bool" name="config_lidControlsScreenLock" />
<java-symbol type="bool" name="config_lidControlsSleep" />
diff --git a/core/tests/coretests/src/android/app/ApplicationLoadersTest.java b/core/tests/coretests/src/android/app/ApplicationLoadersTest.java
new file mode 100644
index 0000000..4b9910c
--- /dev/null
+++ b/core/tests/coretests/src/android/app/ApplicationLoadersTest.java
@@ -0,0 +1,138 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.app;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+
+import android.content.pm.SharedLibraryInfo;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.util.ArrayList;
+
+@RunWith(AndroidJUnit4.class)
+@SmallTest
+public class ApplicationLoadersTest {
+
+ // a library installed onto the device with no dependencies
+ private static final String LIB_A = "/system/framework/android.hidl.base-V1.0-java.jar";
+ // a library installed onto the device which only depends on A
+ private static final String LIB_DEP_A = "/system/framework/android.hidl.manager-V1.0-java.jar";
+
+ private static SharedLibraryInfo createLib(String zip) {
+ return new SharedLibraryInfo(
+ zip, null /*packageName*/, null /*codePaths*/, null /*name*/, 0 /*version*/,
+ SharedLibraryInfo.TYPE_BUILTIN, null /*declaringPackage*/,
+ null /*dependentPackages*/, null /*dependencies*/);
+ }
+
+ @Test
+ public void testGetNonExistantLib() {
+ ApplicationLoaders loaders = new ApplicationLoaders();
+ assertEquals(null, loaders.getCachedNonBootclasspathSystemLib(
+ "/system/framework/nonexistantlib.jar", null, null, null));
+ }
+
+ @Test
+ public void testCacheExistantLib() {
+ ApplicationLoaders loaders = new ApplicationLoaders();
+ SharedLibraryInfo libA = createLib(LIB_A);
+
+ loaders.createAndCacheNonBootclasspathSystemClassLoaders(new SharedLibraryInfo[]{libA});
+
+ assertNotEquals(null, loaders.getCachedNonBootclasspathSystemLib(
+ LIB_A, null, null, null));
+ }
+
+ @Test
+ public void testNonNullParent() {
+ ApplicationLoaders loaders = new ApplicationLoaders();
+ SharedLibraryInfo libA = createLib(LIB_A);
+
+ ClassLoader parent = ClassLoader.getSystemClassLoader();
+ assertNotEquals(null, parent);
+
+ loaders.createAndCacheNonBootclasspathSystemClassLoaders(new SharedLibraryInfo[]{libA});
+
+ assertEquals(null, loaders.getCachedNonBootclasspathSystemLib(
+ LIB_A, parent, null, null));
+ }
+
+ @Test
+ public void testNonNullClassLoaderNamespace() {
+ ApplicationLoaders loaders = new ApplicationLoaders();
+ SharedLibraryInfo libA = createLib(LIB_A);
+
+ loaders.createAndCacheNonBootclasspathSystemClassLoaders(new SharedLibraryInfo[]{libA});
+
+ assertEquals(null, loaders.getCachedNonBootclasspathSystemLib(
+ LIB_A, null, "other classloader", null));
+ }
+
+ @Test
+ public void testDifferentSharedLibraries() {
+ ApplicationLoaders loaders = new ApplicationLoaders();
+ SharedLibraryInfo libA = createLib(LIB_A);
+
+ // any other existant lib
+ ClassLoader dep = ClassLoader.getSystemClassLoader();
+ ArrayList<ClassLoader> sharedLibraries = new ArrayList<>();
+ sharedLibraries.add(dep);
+
+ loaders.createAndCacheNonBootclasspathSystemClassLoaders(new SharedLibraryInfo[]{libA});
+
+ assertEquals(null, loaders.getCachedNonBootclasspathSystemLib(
+ LIB_A, null, null, sharedLibraries));
+ }
+
+ @Test
+ public void testDependentLibs() {
+ ApplicationLoaders loaders = new ApplicationLoaders();
+ SharedLibraryInfo libA = createLib(LIB_A);
+ SharedLibraryInfo libB = createLib(LIB_DEP_A);
+ libB.addDependency(libA);
+
+ loaders.createAndCacheNonBootclasspathSystemClassLoaders(
+ new SharedLibraryInfo[]{libA, libB});
+
+ ClassLoader loadA = loaders.getCachedNonBootclasspathSystemLib(
+ LIB_A, null, null, null);
+ assertNotEquals(null, loadA);
+
+ ArrayList<ClassLoader> sharedLibraries = new ArrayList<>();
+ sharedLibraries.add(loadA);
+
+ assertNotEquals(null, loaders.getCachedNonBootclasspathSystemLib(
+ LIB_DEP_A, null, null, sharedLibraries));
+ }
+
+ @Test(expected = IllegalStateException.class)
+ public void testDependentLibsWrongOrder() {
+ ApplicationLoaders loaders = new ApplicationLoaders();
+ SharedLibraryInfo libA = createLib(LIB_A);
+ SharedLibraryInfo libB = createLib(LIB_DEP_A);
+ libB.addDependency(libA);
+
+ loaders.createAndCacheNonBootclasspathSystemClassLoaders(
+ new SharedLibraryInfo[]{libB, libA});
+ }
+}
diff --git a/libs/androidfw/Asset.cpp b/libs/androidfw/Asset.cpp
index 9a95fdf..92125c9 100644
--- a/libs/androidfw/Asset.cpp
+++ b/libs/androidfw/Asset.cpp
@@ -253,8 +253,10 @@
pAsset = new _FileAsset;
result = pAsset->openChunk(NULL, fd, offset, length);
- if (result != NO_ERROR)
+ if (result != NO_ERROR) {
+ delete pAsset;
return NULL;
+ }
pAsset->mAccessMode = mode;
return pAsset;
@@ -273,8 +275,10 @@
pAsset = new _CompressedAsset;
result = pAsset->openChunk(fd, offset, compressionMethod,
uncompressedLen, compressedLen);
- if (result != NO_ERROR)
+ if (result != NO_ERROR) {
+ delete pAsset;
return NULL;
+ }
pAsset->mAccessMode = mode;
return pAsset;
@@ -328,8 +332,10 @@
pAsset = new _CompressedAsset;
result = pAsset->openChunk(dataMap, uncompressedLen);
- if (result != NO_ERROR)
+ if (result != NO_ERROR) {
+ delete pAsset;
return NULL;
+ }
pAsset->mAccessMode = mode;
return pAsset;
diff --git a/packages/NetworkStack/tests/Android.bp b/packages/NetworkStack/tests/Android.bp
index 0535af3..d0f419c 100644
--- a/packages/NetworkStack/tests/Android.bp
+++ b/packages/NetworkStack/tests/Android.bp
@@ -42,6 +42,7 @@
"libbinder",
"libbinderthreadstate",
"libc++",
+ "libcgrouprc",
"libcrypto",
"libcutils",
"libdexfile",
diff --git a/packages/SettingsLib/src/com/android/settingslib/graph/ThemedBatteryDrawable.kt b/packages/SettingsLib/src/com/android/settingslib/graph/ThemedBatteryDrawable.kt
index 239b1d4..eff02d2 100644
--- a/packages/SettingsLib/src/com/android/settingslib/graph/ThemedBatteryDrawable.kt
+++ b/packages/SettingsLib/src/com/android/settingslib/graph/ThemedBatteryDrawable.kt
@@ -173,6 +173,7 @@
}
override fun draw(c: Canvas) {
+ c.saveLayer(null, null)
unifiedPath.reset()
levelPath.reset()
levelRect.set(fillRect)
@@ -243,6 +244,7 @@
// And draw the plus sign on top of the fill
c.drawPath(scaledPlus, errorPaint)
}
+ c.restore()
}
private fun batteryColorForLevel(level: Int): Int {
diff --git a/packages/SystemUI/res-keyguard/values/alias.xml b/packages/SystemUI/res-keyguard/values/alias.xml
index 1c63c79..6d49b1f 100644
--- a/packages/SystemUI/res-keyguard/values/alias.xml
+++ b/packages/SystemUI/res-keyguard/values/alias.xml
@@ -28,9 +28,6 @@
<!-- Alias used to reference framework configuration for screen rotation. -->
<item type="bool" name="config_enableLockScreenRotation">@*android:bool/config_enableLockScreenRotation</item>
- <!-- Alias used to reference framework configuration for translucent decor. -->
- <item type="bool" name="config_enableLockScreenTranslucentDecor">@*android:bool/config_enableLockScreenTranslucentDecor</item>
-
<!-- Alias used to reference framework activity duration. -->
<item type="integer" name="config_activityDefaultDur">@*android:integer/config_activityDefaultDur</item>
diff --git a/packages/SystemUI/src/com/android/systemui/BatteryMeterView.java b/packages/SystemUI/src/com/android/systemui/BatteryMeterView.java
index 62b0542..de64cf8 100644
--- a/packages/SystemUI/src/com/android/systemui/BatteryMeterView.java
+++ b/packages/SystemUI/src/com/android/systemui/BatteryMeterView.java
@@ -176,10 +176,6 @@
setClipChildren(false);
setClipToPadding(false);
Dependency.get(ConfigurationController.class).observe(viewAttachLifecycle(this), this);
-
- // Needed for PorderDuff.Mode.CLEAR operations to work properly, but redraws don't happen
- // enough to justify a hardware layer.
- setLayerType(LAYER_TYPE_SOFTWARE, null);
}
private void setupLayoutTransition() {
diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java
index de4605b..d850dbc 100644
--- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java
+++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java
@@ -64,6 +64,8 @@
import java.math.BigDecimal;
import java.math.RoundingMode;
+import java.util.Collections;
+import java.util.List;
/**
* Renders bubbles in a stack and handles animating expanded and collapsed states.
@@ -164,6 +166,8 @@
int[] mTempLoc = new int[2];
RectF mTempRect = new RectF();
+ private final List<Rect> mSystemGestureExclusionRects = Collections.singletonList(new Rect());
+
private ViewTreeObserver.OnPreDrawListener mViewUpdater =
new ViewTreeObserver.OnPreDrawListener() {
@Override
@@ -175,6 +179,9 @@
}
};
+ private ViewTreeObserver.OnDrawListener mSystemGestureExcludeUpdater =
+ this::updateSystemGestureExcludeRects;
+
private ViewClippingUtil.ClippingParameters mClippingParameters =
new ViewClippingUtil.ClippingParameters() {
@@ -361,6 +368,19 @@
return false;
}
+ private void updateSystemGestureExcludeRects() {
+ // Exclude the region occupied by the first BubbleView in the stack
+ Rect excludeZone = mSystemGestureExclusionRects.get(0);
+ if (mBubbleContainer.getChildCount() > 0) {
+ View firstBubble = mBubbleContainer.getChildAt(0);
+ excludeZone.set(firstBubble.getLeft(), firstBubble.getTop(), firstBubble.getRight(),
+ firstBubble.getBottom());
+ } else {
+ excludeZone.setEmpty();
+ }
+ mBubbleContainer.setSystemGestureExclusionRects(mSystemGestureExclusionRects);
+ }
+
/**
* Updates the visibility of the 'dot' indicating an update on the bubble.
* @param key the {@link NotificationEntry#key} associated with the bubble.
@@ -669,12 +689,17 @@
updateExpandedBubble();
applyCurrentState();
+ // This must be a separate OnDrawListener since it should be called for every draw.
+ getViewTreeObserver().addOnDrawListener(mSystemGestureExcludeUpdater);
+
mIsExpansionAnimating = true;
Runnable updateAfter = () -> {
applyCurrentState();
mIsExpansionAnimating = false;
requestUpdate();
+ getViewTreeObserver().removeOnDrawListener(mSystemGestureExcludeUpdater);
+ updateSystemGestureExcludeRects();
};
if (shouldExpand) {
diff --git a/services/core/java/com/android/server/DynamicSystemService.java b/services/core/java/com/android/server/DynamicSystemService.java
index 99bbcf8..7a1697f 100644
--- a/services/core/java/com/android/server/DynamicSystemService.java
+++ b/services/core/java/com/android/server/DynamicSystemService.java
@@ -18,16 +18,23 @@
import android.content.Context;
import android.content.pm.PackageManager;
+import android.gsi.GsiInstallParams;
import android.gsi.GsiProgress;
import android.gsi.IGsiService;
+import android.os.Environment;
import android.os.IBinder;
import android.os.IBinder.DeathRecipient;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.SystemProperties;
+import android.os.UserHandle;
import android.os.image.IDynamicSystemService;
+import android.os.storage.StorageManager;
+import android.os.storage.StorageVolume;
import android.util.Slog;
+import java.io.File;
+
/**
* DynamicSystemService implements IDynamicSystemService. It provides permission check before
* passing requests to gsid
@@ -36,7 +43,7 @@
private static final String TAG = "DynamicSystemService";
private static final String NO_SERVICE_ERROR = "no gsiservice";
private static final int GSID_ROUGH_TIMEOUT_MS = 8192;
-
+ private static final String PATH_DEFAULT = "/data/gsi";
private Context mContext;
private volatile IGsiService mGsiService;
@@ -100,7 +107,32 @@
@Override
public boolean startInstallation(long systemSize, long userdataSize) throws RemoteException {
- return getGsiService().startGsiInstall(systemSize, userdataSize, true) == 0;
+ // priority from high to low: sysprop -> sdcard -> /data
+ String path = SystemProperties.get("os.aot.path");
+ if (path.isEmpty()) {
+ final int userId = UserHandle.myUserId();
+ final StorageVolume[] volumes =
+ StorageManager.getVolumeList(userId, StorageManager.FLAG_FOR_WRITE);
+ for (StorageVolume volume : volumes) {
+ if (volume.isEmulated()) continue;
+ if (!volume.isRemovable()) continue;
+ if (!Environment.MEDIA_MOUNTED.equals(volume.getState())) continue;
+ File sdCard = volume.getPathFile();
+ if (sdCard.isDirectory()) {
+ path = sdCard.getPath();
+ break;
+ }
+ }
+ if (path.isEmpty()) {
+ path = PATH_DEFAULT;
+ }
+ Slog.i(TAG, "startInstallation -> " + path);
+ }
+ GsiInstallParams installParams = new GsiInstallParams();
+ installParams.installDir = path;
+ installParams.gsiSize = systemSize;
+ installParams.userdataSize = userdataSize;
+ return getGsiService().beginGsiInstall(installParams) == 0;
}
@Override
diff --git a/services/core/java/com/android/server/am/BatteryStatsService.java b/services/core/java/com/android/server/am/BatteryStatsService.java
index f86ba27..ae3324c 100644
--- a/services/core/java/com/android/server/am/BatteryStatsService.java
+++ b/services/core/java/com/android/server/am/BatteryStatsService.java
@@ -720,10 +720,10 @@
}
}
- public void notePhoneDataConnectionState(int dataType, boolean hasData) {
+ public void notePhoneDataConnectionState(int dataType, boolean hasData, int serviceType) {
enforceCallingPermission();
synchronized (mStats) {
- mStats.notePhoneDataConnectionStateLocked(dataType, hasData);
+ mStats.notePhoneDataConnectionStateLocked(dataType, hasData, serviceType);
}
}
diff --git a/services/core/java/com/android/server/biometrics/BiometricService.java b/services/core/java/com/android/server/biometrics/BiometricService.java
index 516844d..a64eacb 100644
--- a/services/core/java/com/android/server/biometrics/BiometricService.java
+++ b/services/core/java/com/android/server/biometrics/BiometricService.java
@@ -19,7 +19,6 @@
import static android.Manifest.permission.USE_BIOMETRIC;
import static android.Manifest.permission.USE_BIOMETRIC_INTERNAL;
import static android.Manifest.permission.USE_FINGERPRINT;
-import static android.app.ActivityManager.RunningAppProcessInfo.IMPORTANCE_FOREGROUND;
import static android.hardware.biometrics.BiometricAuthenticator.TYPE_FACE;
import static android.hardware.biometrics.BiometricAuthenticator.TYPE_FINGERPRINT;
import static android.hardware.biometrics.BiometricAuthenticator.TYPE_IRIS;
@@ -576,30 +575,9 @@
if (useDefaultTitle) {
checkInternalPermission();
// Set the default title if necessary
- try {
- final List<ActivityManager.RunningAppProcessInfo> procs =
- ActivityManager.getService().getRunningAppProcesses();
- for (int i = 0; i < procs.size(); i++) {
- final ActivityManager.RunningAppProcessInfo info = procs.get(i);
- if (info.uid == callingUid
- && info.importance == IMPORTANCE_FOREGROUND) {
- PackageManager pm = getContext().getPackageManager();
- final CharSequence label = pm.getApplicationLabel(
- pm.getApplicationInfo(info.processName,
- PackageManager.GET_META_DATA));
- final String title = getContext()
- .getString(R.string.biometric_dialog_default_title, label);
- if (TextUtils.isEmpty(
- bundle.getCharSequence(BiometricPrompt.KEY_TITLE))) {
- bundle.putCharSequence(BiometricPrompt.KEY_TITLE, title);
- }
- break;
- }
- }
- } catch (RemoteException e) {
- Slog.e(TAG, "Remote exception", e);
- } catch (PackageManager.NameNotFoundException e) {
- Slog.e(TAG, "Name not found", e);
+ if (TextUtils.isEmpty(bundle.getCharSequence(BiometricPrompt.KEY_TITLE))) {
+ bundle.putCharSequence(BiometricPrompt.KEY_TITLE,
+ getContext().getString(R.string.biometric_dialog_default_title));
}
}
diff --git a/services/core/java/com/android/server/biometrics/BiometricServiceBase.java b/services/core/java/com/android/server/biometrics/BiometricServiceBase.java
index d8e7b7d..c4855c3 100644
--- a/services/core/java/com/android/server/biometrics/BiometricServiceBase.java
+++ b/services/core/java/com/android/server/biometrics/BiometricServiceBase.java
@@ -1045,10 +1045,15 @@
}
} else {
currentClient.stop(initiatedByClient);
+
+ // Only post the reset runnable for non-cleanup clients. Cleanup clients should
+ // never be forcibly stopped since they ensure synchronization between HAL and
+ // framework. Thus, we should instead just start the pending client once cleanup
+ // finishes instead of using the reset runnable.
+ mHandler.removeCallbacks(mResetClientState);
+ mHandler.postDelayed(mResetClientState, CANCEL_TIMEOUT_LIMIT);
}
mPendingClient = newClient;
- mHandler.removeCallbacks(mResetClientState);
- mHandler.postDelayed(mResetClientState, CANCEL_TIMEOUT_LIMIT);
} else if (newClient != null) {
// For BiometricPrompt clients, do not start until
// <Biometric>Service#startPreparedClient is called. BiometricService waits until all
@@ -1225,6 +1230,7 @@
} else {
clearEnumerateState();
if (mPendingClient != null) {
+ Slog.d(getTag(), "Enumerate finished, starting pending client");
startClient(mPendingClient, false /* initiatedByClient */);
}
}
diff --git a/services/core/java/com/android/server/connectivity/DataConnectionStats.java b/services/core/java/com/android/server/connectivity/DataConnectionStats.java
index 227ab23..4990ea1 100644
--- a/services/core/java/com/android/server/connectivity/DataConnectionStats.java
+++ b/services/core/java/com/android/server/connectivity/DataConnectionStats.java
@@ -91,7 +91,8 @@
if (DEBUG) Log.d(TAG, String.format("Noting data connection for network type %s: %svisible",
networkType, visible ? "" : "not "));
try {
- mBatteryStats.notePhoneDataConnectionState(networkType, visible);
+ mBatteryStats.notePhoneDataConnectionState(networkType, visible,
+ mServiceState.getState());
} catch (RemoteException e) {
Log.w(TAG, "Error noting data connection state", e);
}
diff --git a/services/core/java/com/android/server/connectivity/PermissionMonitor.java b/services/core/java/com/android/server/connectivity/PermissionMonitor.java
index da1360d..b6946023 100644
--- a/services/core/java/com/android/server/connectivity/PermissionMonitor.java
+++ b/services/core/java/com/android/server/connectivity/PermissionMonitor.java
@@ -469,7 +469,10 @@
*/
@VisibleForTesting
void sendPackagePermissionsToNetd(SparseIntArray netdPermissionsAppIds) {
-
+ if (mNetd == null) {
+ Log.e(TAG, "Failed to get the netd service");
+ return;
+ }
ArrayList<Integer> allPermissionAppIds = new ArrayList<>();
ArrayList<Integer> internetPermissionAppIds = new ArrayList<>();
ArrayList<Integer> updateStatsPermissionAppIds = new ArrayList<>();
diff --git a/services/core/java/com/android/server/display/DisplayPowerController.java b/services/core/java/com/android/server/display/DisplayPowerController.java
index e2ea42e..5fb67dd 100644
--- a/services/core/java/com/android/server/display/DisplayPowerController.java
+++ b/services/core/java/com/android/server/display/DisplayPowerController.java
@@ -572,9 +572,6 @@
public void onSwitchUser(@UserIdInt int newUserId) {
handleSettingsChange(true /* userSwitch */);
mBrightnessTracker.onSwitchUser(newUserId);
- if (mDisplayWhiteBalanceSettings != null) {
- mDisplayWhiteBalanceSettings.onSwitchUser();
- }
}
public ParceledListSlice<AmbientBrightnessDayStats> getAmbientBrightnessStats(
diff --git a/services/core/java/com/android/server/display/color/ColorDisplayService.java b/services/core/java/com/android/server/display/color/ColorDisplayService.java
index 4f81c03..9590f81 100644
--- a/services/core/java/com/android/server/display/color/ColorDisplayService.java
+++ b/services/core/java/com/android/server/display/color/ColorDisplayService.java
@@ -105,10 +105,12 @@
*/
private static final long TRANSITION_DURATION = 3000L;
- private static final int MSG_APPLY_NIGHT_DISPLAY_IMMEDIATE = 0;
- private static final int MSG_APPLY_NIGHT_DISPLAY_ANIMATED = 1;
- private static final int MSG_APPLY_GLOBAL_SATURATION = 2;
- private static final int MSG_APPLY_DISPLAY_WHITE_BALANCE = 3;
+ private static final int MSG_USER_CHANGED = 0;
+ private static final int MSG_SET_UP = 1;
+ private static final int MSG_APPLY_NIGHT_DISPLAY_IMMEDIATE = 2;
+ private static final int MSG_APPLY_NIGHT_DISPLAY_ANIMATED = 3;
+ private static final int MSG_APPLY_GLOBAL_SATURATION = 4;
+ private static final int MSG_APPLY_DISPLAY_WHITE_BALANCE = 5;
/**
* Return value if a setting has not been set.
@@ -186,7 +188,7 @@
// Register listeners now that boot is complete.
if (mCurrentUser != UserHandle.USER_NULL && mUserSetupObserver == null) {
- setUp();
+ mHandler.sendEmptyMessage(MSG_SET_UP);
}
}
}
@@ -196,7 +198,9 @@
super.onStartUser(userHandle);
if (mCurrentUser == UserHandle.USER_NULL) {
- onUserChanged(userHandle);
+ final Message message = mHandler.obtainMessage(MSG_USER_CHANGED);
+ message.arg1 = userHandle;
+ mHandler.sendMessage(message);
}
}
@@ -204,7 +208,9 @@
public void onSwitchUser(int userHandle) {
super.onSwitchUser(userHandle);
- onUserChanged(userHandle);
+ final Message message = mHandler.obtainMessage(MSG_USER_CHANGED);
+ message.arg1 = userHandle;
+ mHandler.sendMessage(message);
}
@Override
@@ -212,7 +218,9 @@
super.onStopUser(userHandle);
if (mCurrentUser == userHandle) {
- onUserChanged(UserHandle.USER_NULL);
+ final Message message = mHandler.obtainMessage(MSG_USER_CHANGED);
+ message.arg1 = UserHandle.USER_NULL;
+ mHandler.sendMessage(message);
}
}
@@ -262,7 +270,7 @@
// Listen for external changes to any of the settings.
if (mContentObserver == null) {
- mContentObserver = new ContentObserver(new Handler(DisplayThread.get().getLooper())) {
+ mContentObserver = new ContentObserver(mHandler) {
@Override
public void onChange(boolean selfChange, Uri uri) {
super.onChange(selfChange, uri);
@@ -467,6 +475,9 @@
* Apply the accessibility daltonizer transform based on the settings value.
*/
private void onAccessibilityDaltonizerChanged() {
+ if (mCurrentUser == UserHandle.USER_NULL) {
+ return;
+ }
final boolean enabled = Secure.getIntForUser(getContext().getContentResolver(),
Secure.ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED, 0, mCurrentUser) != 0;
final int daltonizerMode = enabled ? Secure.getIntForUser(getContext().getContentResolver(),
@@ -490,6 +501,9 @@
* Apply the accessibility inversion transform based on the settings value.
*/
private void onAccessibilityInversionChanged() {
+ if (mCurrentUser == UserHandle.USER_NULL) {
+ return;
+ }
final boolean enabled = Secure.getIntForUser(getContext().getContentResolver(),
Secure.ACCESSIBILITY_DISPLAY_INVERSION_ENABLED, 0, mCurrentUser) != 0;
final DisplayTransformManager dtm = getLocalService(DisplayTransformManager.class);
@@ -596,7 +610,19 @@
}
}
+ private boolean setDisplayWhiteBalanceSettingEnabled(boolean enabled) {
+ if (mCurrentUser == UserHandle.USER_NULL) {
+ return false;
+ }
+ return Secure.putIntForUser(getContext().getContentResolver(),
+ Secure.DISPLAY_WHITE_BALANCE_ENABLED,
+ enabled ? 1 : 0, mCurrentUser);
+ }
+
private boolean isDisplayWhiteBalanceSettingEnabled() {
+ if (mCurrentUser == UserHandle.USER_NULL) {
+ return false;
+ }
return Secure.getIntForUser(getContext().getContentResolver(),
Secure.DISPLAY_WHITE_BALANCE_ENABLED, 0, mCurrentUser) == 1;
}
@@ -648,6 +674,9 @@
}
private int getNightDisplayAutoModeRawInternal() {
+ if (mCurrentUser == UserHandle.USER_NULL) {
+ return NOT_SET;
+ }
return Secure
.getIntForUser(getContext().getContentResolver(), Secure.NIGHT_DISPLAY_AUTO_MODE,
NOT_SET, mCurrentUser);
@@ -1214,6 +1243,13 @@
}
/**
+ * Returns whether Display white balance is currently enabled.
+ */
+ public boolean isDisplayWhiteBalanceEnabled() {
+ return isDisplayWhiteBalanceSettingEnabled();
+ }
+
+ /**
* Adds a {@link WeakReference<ColorTransformController>} for a newly started activity, and
* invokes {@link ColorTransformController#applyAppSaturation(float[], float[])} if needed.
*/
@@ -1233,7 +1269,7 @@
* Notify that the display white balance status has changed, either due to preemption by
* another transform or the feature being turned off.
*/
- void onDisplayWhiteBalanceStatusChanged(boolean enabled);
+ void onDisplayWhiteBalanceStatusChanged(boolean activated);
}
private final class TintHandler extends Handler {
@@ -1245,6 +1281,12 @@
@Override
public void handleMessage(Message msg) {
switch (msg.what) {
+ case MSG_USER_CHANGED:
+ onUserChanged(msg.arg1);
+ break;
+ case MSG_SET_UP:
+ setUp();
+ break;
case MSG_APPLY_GLOBAL_SATURATION:
mGlobalSaturationTintController.setMatrix(msg.arg1);
applyTint(mGlobalSaturationTintController, false);
@@ -1500,6 +1542,29 @@
}
@Override
+ public boolean setDisplayWhiteBalanceEnabled(boolean enabled) {
+ getContext().enforceCallingOrSelfPermission(
+ Manifest.permission.CONTROL_DISPLAY_COLOR_TRANSFORMS,
+ "Permission required to set night display activated");
+ final long token = Binder.clearCallingIdentity();
+ try {
+ return setDisplayWhiteBalanceSettingEnabled(enabled);
+ } finally {
+ Binder.restoreCallingIdentity(token);
+ }
+ }
+
+ @Override
+ public boolean isDisplayWhiteBalanceEnabled() {
+ final long token = Binder.clearCallingIdentity();
+ try {
+ return isDisplayWhiteBalanceSettingEnabled();
+ } finally {
+ Binder.restoreCallingIdentity(token);
+ }
+ }
+
+ @Override
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
if (!DumpUtils.checkDumpPermission(getContext(), TAG, pw)) {
return;
diff --git a/services/core/java/com/android/server/display/whitebalance/DisplayWhiteBalanceSettings.java b/services/core/java/com/android/server/display/whitebalance/DisplayWhiteBalanceSettings.java
index 1b7251c..6e78894 100644
--- a/services/core/java/com/android/server/display/whitebalance/DisplayWhiteBalanceSettings.java
+++ b/services/core/java/com/android/server/display/whitebalance/DisplayWhiteBalanceSettings.java
@@ -18,13 +18,9 @@
import android.annotation.NonNull;
import android.content.Context;
-import android.database.ContentObserver;
-import android.net.Uri;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
-import android.os.UserHandle;
-import android.provider.Settings.Secure;
import android.util.Slog;
import com.android.internal.util.Preconditions;
@@ -46,22 +42,19 @@
protected static final String TAG = "DisplayWhiteBalanceSettings";
protected boolean mLoggingEnabled;
- private static final String SETTING_URI = Secure.DISPLAY_WHITE_BALANCE_ENABLED;
- private static final int SETTING_DEFAULT = 0;
- private static final int SETTING_ENABLED = 1;
-
private static final int MSG_SET_ACTIVE = 1;
private final Context mContext;
private final Handler mHandler;
- private final SettingsObserver mSettingsObserver;
+
+ private final ColorDisplayServiceInternal mCdsi;
// To decouple the DisplayPowerController from the DisplayWhiteBalanceSettings, the DPC
// implements Callbacks and passes itself to the DWBS so it can call back into it without
// knowing about it.
private Callbacks mCallbacks;
- private int mSetting;
+ private boolean mEnabled;
private boolean mActive;
/**
@@ -79,18 +72,12 @@
mLoggingEnabled = false;
mContext = context;
mHandler = new DisplayWhiteBalanceSettingsHandler(handler.getLooper());
- mSettingsObserver = new SettingsObserver(mHandler);
- mSetting = getSetting();
- mActive = false;
mCallbacks = null;
- mContext.getContentResolver().registerContentObserver(
- Secure.getUriFor(SETTING_URI), false /* notifyForDescendants */, mSettingsObserver,
- UserHandle.USER_ALL);
-
- ColorDisplayServiceInternal cds =
- LocalServices.getService(ColorDisplayServiceInternal.class);
- cds.setDisplayWhiteBalanceListener(this);
+ mCdsi = LocalServices.getService(ColorDisplayServiceInternal.class);
+ setEnabled(mCdsi.isDisplayWhiteBalanceEnabled());
+ final boolean isActive = mCdsi.setDisplayWhiteBalanceListener(this);
+ setActive(isActive);
}
/**
@@ -99,7 +86,7 @@
* @param callbacks
* The object to call back to.
*
- * @return Whether the method suceeded or not.
+ * @return Whether the method succeeded or not.
*/
public boolean setCallbacks(Callbacks callbacks) {
if (mCallbacks == callbacks) {
@@ -131,14 +118,7 @@
* @return Whether display white-balance is enabled.
*/
public boolean isEnabled() {
- return (mSetting == SETTING_ENABLED) && mActive;
- }
-
- /**
- * Re-evaluate state after switching to a new user.
- */
- public void onSwitchUser() {
- handleSettingChange();
+ return mEnabled && mActive;
}
/**
@@ -152,15 +132,14 @@
writer.println(" mLoggingEnabled=" + mLoggingEnabled);
writer.println(" mContext=" + mContext);
writer.println(" mHandler=" + mHandler);
- writer.println(" mSettingsObserver=" + mSettingsObserver);
- writer.println(" mSetting=" + mSetting);
+ writer.println(" mEnabled=" + mEnabled);
writer.println(" mActive=" + mActive);
writer.println(" mCallbacks=" + mCallbacks);
}
@Override
- public void onDisplayWhiteBalanceStatusChanged(boolean active) {
- Message msg = mHandler.obtainMessage(MSG_SET_ACTIVE, active ? 1 : 0, 0);
+ public void onDisplayWhiteBalanceStatusChanged(boolean activated) {
+ Message msg = mHandler.obtainMessage(MSG_SET_ACTIVE, activated ? 1 : 0, 0);
msg.sendToTarget();
}
@@ -169,20 +148,14 @@
Preconditions.checkNotNull(handler, "handler must not be null");
}
- private int getSetting() {
- return Secure.getIntForUser(mContext.getContentResolver(), SETTING_URI, SETTING_DEFAULT,
- UserHandle.USER_CURRENT);
- }
-
- private void handleSettingChange() {
- final int setting = getSetting();
- if (mSetting == setting) {
+ private void setEnabled(boolean enabled) {
+ if (mEnabled == enabled) {
return;
}
if (mLoggingEnabled) {
- Slog.d(TAG, "Setting: " + setting);
+ Slog.d(TAG, "Setting: " + enabled);
}
- mSetting = setting;
+ mEnabled = enabled;
if (mCallbacks != null) {
mCallbacks.updateWhiteBalance();
}
@@ -201,17 +174,6 @@
}
}
- private final class SettingsObserver extends ContentObserver {
- SettingsObserver(Handler handler) {
- super(handler);
- }
-
- @Override
- public void onChange(boolean selfChange, Uri uri) {
- handleSettingChange();
- }
- }
-
private final class DisplayWhiteBalanceSettingsHandler extends Handler {
DisplayWhiteBalanceSettingsHandler(Looper looper) {
super(looper, null, true /* async */);
@@ -222,6 +184,7 @@
switch (msg.what) {
case MSG_SET_ACTIVE:
setActive(msg.arg1 != 0);
+ setEnabled(mCdsi.isDisplayWhiteBalanceEnabled());
break;
}
}
diff --git a/services/core/java/com/android/server/wm/DisplayPolicy.java b/services/core/java/com/android/server/wm/DisplayPolicy.java
index bbb857f..6ae7720 100644
--- a/services/core/java/com/android/server/wm/DisplayPolicy.java
+++ b/services/core/java/com/android/server/wm/DisplayPolicy.java
@@ -49,7 +49,7 @@
import static android.view.WindowManager.LayoutParams.LAST_SUB_WINDOW;
import static android.view.WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT;
import static android.view.WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES;
-import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_FORCE_DRAW_STATUS_BAR_BACKGROUND;
+import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_FORCE_DRAW_BAR_BACKGROUNDS;
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_FORCE_STATUS_BAR_VISIBLE_TRANSPARENT;
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_INHERIT_TRANSLUCENT_DECOR;
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_IS_SCREEN_DECOR;
@@ -211,7 +211,6 @@
private final boolean mCarDockEnablesAccelerometer;
private final boolean mDeskDockEnablesAccelerometer;
- private final boolean mTranslucentDecorEnabled;
private final AccessibilityManager mAccessibilityManager;
private final ImmersiveModeConfirmation mImmersiveModeConfirmation;
private final ScreenshotHelper mScreenshotHelper;
@@ -434,7 +433,6 @@
final Resources r = mContext.getResources();
mCarDockEnablesAccelerometer = r.getBoolean(R.bool.config_carDockEnablesAccelerometer);
mDeskDockEnablesAccelerometer = r.getBoolean(R.bool.config_deskDockEnablesAccelerometer);
- mTranslucentDecorEnabled = r.getBoolean(R.bool.config_enableTranslucentDecor);
mForceShowSystemBarsFromExternal = r.getBoolean(R.bool.config_forceShowSystemBars);
mAccessibilityManager = (AccessibilityManager) mContext.getSystemService(
@@ -1287,14 +1285,12 @@
private static int getImpliedSysUiFlagsForLayout(LayoutParams attrs) {
int impliedFlags = 0;
- if ((attrs.flags & FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) != 0) {
- impliedFlags |= View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION;
- }
- final boolean forceWindowDrawsStatusBarBackground =
- (attrs.privateFlags & PRIVATE_FLAG_FORCE_DRAW_STATUS_BAR_BACKGROUND) != 0;
+ final boolean forceWindowDrawsBarBackgrounds =
+ (attrs.privateFlags & PRIVATE_FLAG_FORCE_DRAW_BAR_BACKGROUNDS) != 0
+ && attrs.height == MATCH_PARENT && attrs.width == MATCH_PARENT;
if ((attrs.flags & FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) != 0
- || forceWindowDrawsStatusBarBackground
- && attrs.height == MATCH_PARENT && attrs.width == MATCH_PARENT) {
+ || forceWindowDrawsBarBackgrounds) {
+ impliedFlags |= View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION;
impliedFlags |= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;
}
return impliedFlags;
@@ -1396,9 +1392,6 @@
navTranslucent &= !immersiveSticky; // transient trumps translucent
boolean isKeyguardShowing = isStatusBarKeyguard()
&& !mService.mPolicy.isKeyguardOccluded();
- if (!isKeyguardShowing) {
- navTranslucent &= areTranslucentBarsAllowed();
- }
boolean statusBarForcesShowingNavigation = !isKeyguardShowing && mStatusBar != null
&& (mStatusBar.getAttrs().privateFlags
& PRIVATE_FLAG_STATUS_FORCE_SHOW_NAVIGATION) != 0;
@@ -1560,9 +1553,6 @@
boolean statusBarTransient = (sysui & View.STATUS_BAR_TRANSIENT) != 0;
boolean statusBarTranslucent = (sysui
& (View.STATUS_BAR_TRANSLUCENT | View.STATUS_BAR_TRANSPARENT)) != 0;
- if (!isKeyguardShowing) {
- statusBarTranslucent &= areTranslucentBarsAllowed();
- }
// If the status bar is hidden, we don't want to cause windows behind it to scroll.
if (mStatusBar.isVisibleLw() && !statusBarTransient) {
@@ -1915,13 +1905,14 @@
&& (fl & FLAG_FULLSCREEN) == 0
&& (fl & FLAG_TRANSLUCENT_STATUS) == 0
&& (fl & FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) == 0
- && (pfl & PRIVATE_FLAG_FORCE_DRAW_STATUS_BAR_BACKGROUND) == 0) {
+ && (pfl & PRIVATE_FLAG_FORCE_DRAW_BAR_BACKGROUNDS) == 0) {
// Ensure policy decor includes status bar
dcf.top = displayFrames.mStable.top;
}
if ((fl & FLAG_TRANSLUCENT_NAVIGATION) == 0
&& (sysUiFl & View.SYSTEM_UI_FLAG_HIDE_NAVIGATION) == 0
- && (fl & FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) == 0) {
+ && (fl & FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) == 0
+ && (pfl & PRIVATE_FLAG_FORCE_DRAW_BAR_BACKGROUNDS) == 0) {
// Ensure policy decor includes navigation bar
dcf.bottom = displayFrames.mStable.bottom;
dcf.right = displayFrames.mStable.right;
@@ -3148,6 +3139,8 @@
drawsStatusBarBackground(vis, mTopFullscreenOpaqueWindowState);
final boolean dockedDrawsStatusBarBackground =
drawsStatusBarBackground(dockedVis, mTopDockedOpaqueWindowState);
+ final boolean fullscreenDrawsNavBarBackground =
+ drawsNavigationBarBackground(vis, mTopFullscreenOpaqueWindowState);
// prevent status bar interaction from clearing certain flags
int type = win.getAttrs().type;
@@ -3167,12 +3160,12 @@
if (fullscreenDrawsStatusBarBackground && dockedDrawsStatusBarBackground) {
vis |= View.STATUS_BAR_TRANSPARENT;
vis &= ~View.STATUS_BAR_TRANSLUCENT;
- } else if ((!areTranslucentBarsAllowed() && fullscreenTransWin != mStatusBar)
- || forceOpaqueStatusBar) {
+ } else if (forceOpaqueStatusBar) {
vis &= ~(View.STATUS_BAR_TRANSLUCENT | View.STATUS_BAR_TRANSPARENT);
}
- vis = configureNavBarOpacity(vis, dockedStackVisible, freeformStackVisible, resizing);
+ vis = configureNavBarOpacity(vis, dockedStackVisible, freeformStackVisible, resizing,
+ fullscreenDrawsNavBarBackground);
// update status bar
boolean immersiveSticky =
@@ -3256,8 +3249,9 @@
return vis;
}
- private boolean drawsStatusBarBackground(int vis, WindowState win) {
- if (!mStatusBarController.isTransparentAllowed(win)) {
+ private boolean drawsBarBackground(int vis, WindowState win, BarController controller,
+ int translucentFlag) {
+ if (!controller.isTransparentAllowed(win)) {
return false;
}
if (win == null) {
@@ -3267,9 +3261,17 @@
final boolean drawsSystemBars =
(win.getAttrs().flags & FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) != 0;
final boolean forceDrawsSystemBars =
- (win.getAttrs().privateFlags & PRIVATE_FLAG_FORCE_DRAW_STATUS_BAR_BACKGROUND) != 0;
+ (win.getAttrs().privateFlags & PRIVATE_FLAG_FORCE_DRAW_BAR_BACKGROUNDS) != 0;
- return forceDrawsSystemBars || drawsSystemBars && (vis & View.STATUS_BAR_TRANSLUCENT) == 0;
+ return forceDrawsSystemBars || drawsSystemBars && (vis & translucentFlag) == 0;
+ }
+
+ private boolean drawsStatusBarBackground(int vis, WindowState win) {
+ return drawsBarBackground(vis, win, mStatusBarController, FLAG_TRANSLUCENT_STATUS);
+ }
+
+ private boolean drawsNavigationBarBackground(int vis, WindowState win) {
+ return drawsBarBackground(vis, win, mNavigationBarController, FLAG_TRANSLUCENT_NAVIGATION);
}
/**
@@ -3277,10 +3279,13 @@
* on the nav bar opacity rules chosen by {@link #mNavBarOpacityMode}.
*/
private int configureNavBarOpacity(int visibility, boolean dockedStackVisible,
- boolean freeformStackVisible, boolean isDockedDividerResizing) {
+ boolean freeformStackVisible, boolean isDockedDividerResizing,
+ boolean fullscreenDrawsBackground) {
if (mNavBarOpacityMode == NAV_BAR_OPAQUE_WHEN_FREEFORM_OR_DOCKED) {
if (dockedStackVisible || freeformStackVisible || isDockedDividerResizing) {
visibility = setNavBarOpaqueFlag(visibility);
+ } else if (fullscreenDrawsBackground) {
+ visibility = setNavBarTransparentFlag(visibility);
}
} else if (mNavBarOpacityMode == NAV_BAR_TRANSLUCENT_WHEN_FREEFORM_OPAQUE_OTHERWISE) {
if (isDockedDividerResizing) {
@@ -3292,9 +3297,6 @@
}
}
- if (!areTranslucentBarsAllowed()) {
- visibility &= ~View.NAVIGATION_BAR_TRANSLUCENT;
- }
return visibility;
}
@@ -3307,6 +3309,11 @@
return visibility | View.NAVIGATION_BAR_TRANSLUCENT;
}
+ private int setNavBarTransparentFlag(int visibility) {
+ visibility &= ~View.NAVIGATION_BAR_TRANSLUCENT;
+ return visibility | View.NAVIGATION_BAR_TRANSPARENT;
+ }
+
private void clearClearableFlagsLw() {
int newVal = mResettingSystemUiFlags | View.SYSTEM_UI_CLEARABLE_FLAGS;
if (newVal != mResettingSystemUiFlags) {
@@ -3338,16 +3345,6 @@
return (systemUiFlags & disableNavigationBar) == disableNavigationBar;
}
- /**
- * @return whether the navigation or status bar can be made translucent
- *
- * This should return true unless touch exploration is not enabled or
- * R.boolean.config_enableTranslucentDecor is false.
- */
- private boolean areTranslucentBarsAllowed() {
- return mTranslucentDecorEnabled;
- }
-
boolean shouldRotateSeamlessly(DisplayRotation displayRotation, int oldRotation,
int newRotation) {
// For the upside down rotation we don't rotate seamlessly as the navigation
diff --git a/services/core/java/com/android/server/wm/TaskSnapshotSurface.java b/services/core/java/com/android/server/wm/TaskSnapshotSurface.java
index dafed9e..39b5662 100644
--- a/services/core/java/com/android/server/wm/TaskSnapshotSurface.java
+++ b/services/core/java/com/android/server/wm/TaskSnapshotSurface.java
@@ -29,8 +29,10 @@
import static android.view.WindowManager.LayoutParams.FLAG_SECURE;
import static android.view.WindowManager.LayoutParams.FLAG_SLIPPERY;
import static android.view.WindowManager.LayoutParams.FLAG_SPLIT_TOUCH;
+import static android.view.WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION;
+import static android.view.WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS;
import static android.view.WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH;
-import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_FORCE_DRAW_STATUS_BAR_BACKGROUND;
+import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_FORCE_DRAW_BAR_BACKGROUNDS;
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_STARTING;
import static com.android.internal.policy.DecorView.NAVIGATION_BAR_COLOR_VIEW_ATTRIBUTES;
@@ -104,7 +106,7 @@
| FLAG_SCALED
| FLAG_SECURE;
- private static final int PRIVATE_FLAG_INHERITS = PRIVATE_FLAG_FORCE_DRAW_STATUS_BAR_BACKGROUND;
+ private static final int PRIVATE_FLAG_INHERITS = PRIVATE_FLAG_FORCE_DRAW_BAR_BACKGROUNDS;
private static final String TAG = TAG_WITH_CLASS_NAME ? "SnapshotStartingWindow" : TAG_WM;
private static final int MSG_REPORT_DRAW = 0;
@@ -493,10 +495,12 @@
mWindowPrivateFlags = windowPrivateFlags;
mSysUiVis = sysUiVis;
final Context context = ActivityThread.currentActivityThread().getSystemUiContext();
- mStatusBarColor = DecorView.calculateStatusBarColor(windowFlags,
- context.getColor(R.color.system_bar_background_semi_transparent),
- statusBarColor);
- mNavigationBarColor = navigationBarColor;
+ final int semiTransparent = context.getColor(
+ R.color.system_bar_background_semi_transparent);
+ mStatusBarColor = DecorView.calculateBarColor(windowFlags, FLAG_TRANSLUCENT_STATUS,
+ semiTransparent, statusBarColor);
+ mNavigationBarColor = DecorView.calculateBarColor(windowFlags,
+ FLAG_TRANSLUCENT_NAVIGATION, semiTransparent, navigationBarColor);
mStatusBarPaint.setColor(mStatusBarColor);
mNavigationBarPaint.setColor(navigationBarColor);
}
@@ -507,10 +511,10 @@
}
int getStatusBarColorViewHeight() {
- final boolean forceStatusBarBackground =
- (mWindowPrivateFlags & PRIVATE_FLAG_FORCE_DRAW_STATUS_BAR_BACKGROUND) != 0;
+ final boolean forceBarBackground =
+ (mWindowPrivateFlags & PRIVATE_FLAG_FORCE_DRAW_BAR_BACKGROUNDS) != 0;
if (STATUS_BAR_COLOR_VIEW_ATTRIBUTES.isVisible(
- mSysUiVis, mStatusBarColor, mWindowFlags, forceStatusBarBackground)) {
+ mSysUiVis, mStatusBarColor, mWindowFlags, forceBarBackground)) {
return getColorViewTopInset(mStableInsets.top, mContentInsets.top);
} else {
return 0;
@@ -518,8 +522,10 @@
}
private boolean isNavigationBarColorViewVisible() {
+ final boolean forceBarBackground =
+ (mWindowPrivateFlags & PRIVATE_FLAG_FORCE_DRAW_BAR_BACKGROUNDS) != 0;
return NAVIGATION_BAR_COLOR_VIEW_ATTRIBUTES.isVisible(
- mSysUiVis, mNavigationBarColor, mWindowFlags, false /* force */);
+ mSysUiVis, mNavigationBarColor, mWindowFlags, forceBarBackground);
}
void drawDecors(Canvas c, @Nullable Rect alreadyDrawnFrame) {
diff --git a/services/tests/wmtests/src/com/android/server/wm/DisplayPolicyLayoutTests.java b/services/tests/wmtests/src/com/android/server/wm/DisplayPolicyLayoutTests.java
index 03969da..e90f094 100644
--- a/services/tests/wmtests/src/com/android/server/wm/DisplayPolicyLayoutTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/DisplayPolicyLayoutTests.java
@@ -27,7 +27,7 @@
import static android.view.WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN;
import static android.view.WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS;
import static android.view.WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_NEVER;
-import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_FORCE_DRAW_STATUS_BAR_BACKGROUND;
+import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_FORCE_DRAW_BAR_BACKGROUNDS;
import static android.view.WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING;
import static android.view.WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE;
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION;
@@ -142,20 +142,20 @@
}
@Test
- public void layoutWindowLw_appWontDrawBars_forceStatus() throws Exception {
+ public void layoutWindowLw_appWontDrawBars_forceStatusAndNav() throws Exception {
synchronized (mWm.mGlobalLock) {
mWindow.mAttrs.flags &= ~FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS;
- mWindow.mAttrs.privateFlags |= PRIVATE_FLAG_FORCE_DRAW_STATUS_BAR_BACKGROUND;
+ mWindow.mAttrs.privateFlags |= PRIVATE_FLAG_FORCE_DRAW_BAR_BACKGROUNDS;
addWindow(mWindow);
mDisplayPolicy.beginLayoutLw(mFrames, 0 /* UI mode */);
mDisplayPolicy.layoutWindowLw(mWindow, null, mFrames);
- assertInsetByTopBottom(mWindow.getParentFrame(), 0, NAV_BAR_HEIGHT);
+ assertInsetByTopBottom(mWindow.getParentFrame(), 0, 0);
assertInsetByTopBottom(mWindow.getStableFrameLw(), STATUS_BAR_HEIGHT, NAV_BAR_HEIGHT);
assertInsetByTopBottom(mWindow.getContentFrameLw(), STATUS_BAR_HEIGHT, NAV_BAR_HEIGHT);
- assertInsetByTopBottom(mWindow.getDecorFrame(), 0, NAV_BAR_HEIGHT);
- assertInsetByTopBottom(mWindow.getDisplayFrameLw(), 0, NAV_BAR_HEIGHT);
+ assertInsetByTopBottom(mWindow.getDecorFrame(), 0, 0);
+ assertInsetByTopBottom(mWindow.getDisplayFrameLw(), 0, 0);
}
}
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
index bdd01e2..fb82ca6 100644
--- a/telephony/java/android/telephony/TelephonyManager.java
+++ b/telephony/java/android/telephony/TelephonyManager.java
@@ -5267,6 +5267,18 @@
* Use this method when no subscriptions are available on the SIM and the operation must be
* performed using the physical slot index.
*
+ * This operation wraps two APDU instructions:
+ * <ul>
+ * <li>MANAGE CHANNEL to open a logical channel</li>
+ * <li>SELECT the given {@code AID} using the given {@code p2}</li>
+ * </ul>
+ *
+ * Per Open Mobile API Specification v3.2 section 6.2.7.h, only p2 values of 0x00, 0x04, 0x08,
+ * and 0x0C are guaranteed to be supported.
+ *
+ * If the SELECT command's status word is not '9000', '62xx', or '63xx', the status word will be
+ * considered an error and the channel shall not be opened.
+ *
* Input parameters equivalent to TS 27.007 AT+CCHO command.
*
* <p>Requires Permission:
@@ -5298,6 +5310,18 @@
/**
* Opens a logical channel to the ICC card.
*
+ * This operation wraps two APDU instructions:
+ * <ul>
+ * <li>MANAGE CHANNEL to open a logical channel</li>
+ * <li>SELECT the given {@code AID} using the given {@code p2}</li>
+ * </ul>
+ *
+ * Per Open Mobile API Specification v3.2 section 6.2.7.h, only p2 values of 0x00, 0x04, 0x08,
+ * and 0x0C are guaranteed to be supported.
+ *
+ * If the SELECT command's status word is not '9000', '62xx', or '63xx', the status word will be
+ * considered an error and the channel shall not be opened.
+ *
* Input parameters equivalent to TS 27.007 AT+CCHO command.
*
* <p>Requires Permission:
@@ -5315,6 +5339,18 @@
/**
* Opens a logical channel to the ICC card.
*
+ * This operation wraps two APDU instructions:
+ * <ul>
+ * <li>MANAGE CHANNEL to open a logical channel</li>
+ * <li>SELECT the given {@code AID} using the given {@code p2}</li>
+ * </ul>
+ *
+ * Per Open Mobile API Specification v3.2 section 6.2.7.h, only p2 values of 0x00, 0x04, 0x08,
+ * and 0x0C are guaranteed to be supported.
+ *
+ * If the SELECT command's status word is not '9000', '62xx', or '63xx', the status word will be
+ * considered an error and the channel shall not be opened.
+ *
* Input parameters equivalent to TS 27.007 AT+CCHO command.
*
* <p>Requires Permission:
diff --git a/tests/net/java/android/net/netlink/InetDiagSocketTest.java b/tests/net/java/android/net/netlink/InetDiagSocketTest.java
index b6038ab..8b2b4e3 100644
--- a/tests/net/java/android/net/netlink/InetDiagSocketTest.java
+++ b/tests/net/java/android/net/netlink/InetDiagSocketTest.java
@@ -189,7 +189,6 @@
udp.close();
}
- @Test
public void testGetConnectionOwnerUid() throws Exception {
checkGetConnectionOwnerUid("::", null);
checkGetConnectionOwnerUid("::", "::");