Merge "Fix EncodedBuffer_test to run after making EncodedBuffer inherit from RefBase" into qt-dev
diff --git a/core/java/android/app/admin/SecurityLog.java b/core/java/android/app/admin/SecurityLog.java
index 19f4335..9727621 100644
--- a/core/java/android/app/admin/SecurityLog.java
+++ b/core/java/android/app/admin/SecurityLog.java
@@ -636,6 +636,11 @@
public int hashCode() {
return Objects.hash(mEvent, mId);
}
+
+ /** @hide */
+ public boolean eventEquals(SecurityEvent other) {
+ return other != null && mEvent.equals(other.mEvent);
+ }
}
/**
* Retrieve all security logs and return immediately.
diff --git a/core/java/android/app/usage/UsageStatsManager.java b/core/java/android/app/usage/UsageStatsManager.java
index 7fa4360..749a011 100644
--- a/core/java/android/app/usage/UsageStatsManager.java
+++ b/core/java/android/app/usage/UsageStatsManager.java
@@ -281,20 +281,13 @@
/**
* Gets application usage stats for the given time range, aggregated by the specified interval.
- * <p>The returned list will contain a {@link UsageStats} object for each package that
- * has data for an interval that is a subset of the time range given. To illustrate:</p>
- * <pre>
- * intervalType = INTERVAL_YEARLY
- * beginTime = 2013
- * endTime = 2015 (exclusive)
*
- * Results:
- * 2013 - com.example.alpha
- * 2013 - com.example.beta
- * 2014 - com.example.alpha
- * 2014 - com.example.beta
- * 2014 - com.example.charlie
- * </pre>
+ * <p>
+ * The returned list will contain one or more {@link UsageStats} objects for each package, with
+ * usage data that covers at least the given time range.
+ * Note: The begin and end times of the time range may be expanded to the nearest whole interval
+ * period.
+ * </p>
*
* <p> The caller must have {@link android.Manifest.permission#PACKAGE_USAGE_STATS} </p>
*
diff --git a/core/java/android/content/ContentProvider.java b/core/java/android/content/ContentProvider.java
index 71242fb..7cdd268 100644
--- a/core/java/android/content/ContentProvider.java
+++ b/core/java/android/content/ContentProvider.java
@@ -820,6 +820,7 @@
private String setCallingPackage(String callingPackage) {
final String original = mCallingPackage.get();
mCallingPackage.set(callingPackage);
+ onCallingPackageChanged();
return original;
}
@@ -845,6 +846,15 @@
return pkg;
}
+ /** {@hide} */
+ public final @Nullable String getCallingPackageUnchecked() {
+ return mCallingPackage.get();
+ }
+
+ /** {@hide} */
+ public void onCallingPackageChanged() {
+ }
+
/**
* Opaque token representing the identity of an incoming IPC.
*/
diff --git a/core/java/android/provider/DocumentsContract.java b/core/java/android/provider/DocumentsContract.java
index 4ac4850..22ce39d 100644
--- a/core/java/android/provider/DocumentsContract.java
+++ b/core/java/android/provider/DocumentsContract.java
@@ -917,8 +917,17 @@
* @see #getDocumentId(Uri)
*/
public static Uri buildDocumentUri(String authority, String documentId) {
+ return getBaseDocumentUriBuilder(authority).appendPath(documentId).build();
+ }
+
+ /** {@hide} */
+ public static Uri buildBaseDocumentUri(String authority) {
+ return getBaseDocumentUriBuilder(authority).build();
+ }
+
+ private static Uri.Builder getBaseDocumentUriBuilder(String authority) {
return new Uri.Builder().scheme(ContentResolver.SCHEME_CONTENT)
- .authority(authority).appendPath(PATH_DOCUMENT).appendPath(documentId).build();
+ .authority(authority).appendPath(PATH_DOCUMENT);
}
/**
diff --git a/core/java/com/android/internal/os/ZygoteConfig.java b/core/java/com/android/internal/os/ZygoteConfig.java
index c6af8c2..6ebcae1 100644
--- a/core/java/com/android/internal/os/ZygoteConfig.java
+++ b/core/java/com/android/internal/os/ZygoteConfig.java
@@ -34,4 +34,7 @@
/** The minimum number of processes to keep in the USAP pool */
public static final String USAP_POOL_SIZE_MIN = "usap_pool_size_min";
+
+ /** The number of milliseconds to delay before refilling the USAP pool */
+ public static final String USAP_POOL_REFILL_DELAY_MS = "usap_pool_refill_delay_ms";
}
diff --git a/core/java/com/android/internal/os/ZygoteServer.java b/core/java/com/android/internal/os/ZygoteServer.java
index 7eed9b1..492bc94 100644
--- a/core/java/com/android/internal/os/ZygoteServer.java
+++ b/core/java/com/android/internal/os/ZygoteServer.java
@@ -66,11 +66,8 @@
/** The default value used for the USAP_POOL_SIZE_MIN device property */
private static final String USAP_POOL_SIZE_MIN_DEFAULT = "1";
- /**
- * Number of milliseconds to delay before refilling the pool if it hasn't reached its
- * minimum value.
- */
- private static final int USAP_REFILL_DELAY_MS = 3000;
+ /** The default value used for the USAP_REFILL_DELAY_MS device property */
+ private static final String USAP_POOL_REFILL_DELAY_MS_DEFAULT = "3000";
/** The "not a timestamp" value for the refill delay timestamp mechanism. */
private static final int INVALID_TIMESTAMP = -1;
@@ -140,6 +137,12 @@
*/
private int mUsapPoolRefillThreshold = 0;
+ /**
+ * Number of milliseconds to delay before refilling the pool if it hasn't reached its
+ * minimum value.
+ */
+ private int mUsapPoolRefillDelayMs = -1;
+
private enum UsapPoolRefillAction {
DELAYED,
IMMEDIATE,
@@ -282,6 +285,13 @@
mUsapPoolSizeMax);
}
+ final String usapPoolRefillDelayMsPropString = Zygote.getConfigurationProperty(
+ ZygoteConfig.USAP_POOL_REFILL_DELAY_MS, USAP_POOL_REFILL_DELAY_MS_DEFAULT);
+
+ if (!usapPoolRefillDelayMsPropString.isEmpty()) {
+ mUsapPoolRefillDelayMs = Integer.parseInt(usapPoolRefillDelayMsPropString);
+ }
+
// Sanity check
if (mUsapPoolSizeMin >= mUsapPoolSizeMax) {
Log.w(TAG, "The max size of the USAP pool must be greater than the minimum size."
@@ -467,13 +477,13 @@
int elapsedTimeMs =
(int) (System.currentTimeMillis() - usapPoolRefillTriggerTimestamp);
- if (elapsedTimeMs >= USAP_REFILL_DELAY_MS) {
+ if (elapsedTimeMs >= mUsapPoolRefillDelayMs) {
// Normalize the poll timeout value when the time between one poll event and the
// next pushes us over the delay value. This prevents poll receiving a 0
// timeout value, which would result in it returning immediately.
pollTimeoutMs = -1;
} else {
- pollTimeoutMs = USAP_REFILL_DELAY_MS - elapsedTimeMs;
+ pollTimeoutMs = mUsapPoolRefillDelayMs - elapsedTimeMs;
}
}
diff --git a/core/res/res/layout/autofill_save.xml b/core/res/res/layout/autofill_save.xml
index d903524..d4c3565 100644
--- a/core/res/res/layout/autofill_save.xml
+++ b/core/res/res/layout/autofill_save.xml
@@ -26,17 +26,17 @@
android:id="@+id/autofill_save"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
- android:layout_marginTop="32dp"
- android:paddingTop="16dp"
- android:elevation="32dp"
+ android:layout_marginTop="@dimen/autofill_save_outer_top_margin"
+ android:paddingTop="@dimen/autofill_save_outer_top_padding"
+ android:elevation="@dimen/autofill_elevation"
android:background="?android:attr/colorBackground"
android:orientation="vertical">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
- android:paddingStart="16dp"
- android:paddingEnd="16dp"
+ android:paddingStart="@dimen/autofill_save_inner_padding"
+ android:paddingEnd="@dimen/autofill_save_inner_padding"
android:orientation="vertical">
<LinearLayout
@@ -47,17 +47,16 @@
<ImageView
android:id="@+id/autofill_save_icon"
android:scaleType="fitStart"
- android:layout_width="24dp"
- android:layout_height="24dp"/>
+ android:layout_width="@dimen/autofill_save_icon_size"
+ android:layout_height="@dimen/autofill_save_icon_size"/>
<TextView
android:id="@+id/autofill_save_title"
- android:paddingStart="8dp"
+ android:paddingStart="@dimen/autofill_save_title_start_padding"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/autofill_save_title"
- android:textSize="16sp"
- android:textColor="?android:attr/textColorPrimary"
+ android:textAppearance="@style/TextAppearance.DeviceDefault.Subhead"
android:layout_weight="1">
</TextView>
@@ -67,7 +66,7 @@
android:id="@+id/autofill_save_custom_subtitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginTop="4dp"
+ android:layout_marginTop="@dimen/autofill_save_scroll_view_top_margin"
android:visibility="gone"/>
</LinearLayout>
@@ -76,7 +75,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
- android:padding="16dp"
+ android:padding="@dimen/autofill_save_button_bar_padding"
android:clipToPadding="false"
android:layout_weight="1"
android:orientation="horizontal">
diff --git a/core/res/res/values/dimens.xml b/core/res/res/values/dimens.xml
index 167e672..6f11432 100644
--- a/core/res/res/values/dimens.xml
+++ b/core/res/res/values/dimens.xml
@@ -73,6 +73,11 @@
<dimen name="navigation_bar_width_car_mode">96dp</dimen>
<!-- Height of notification icons in the status bar -->
<dimen name="status_bar_icon_size">22dip</dimen>
+ <!-- Desired size of system icons in status bar. -->
+ <dimen name="status_bar_system_icon_size">15dp</dimen>
+ <!-- Intrinsic size of most system icons in status bar. This is the default value that
+ is used if a Drawable reports an intrinsic size of 0. -->
+ <dimen name="status_bar_system_icon_intrinsic_size">17dp</dimen>
<!-- Size of the giant number (unread count) in the notifications -->
<dimen name="status_bar_content_number_size">48sp</dimen>
<!-- Margin at the edge of the screen to ignore touch events for in the windowshade. -->
@@ -668,6 +673,16 @@
<dimen name="autofill_dataset_picker_max_width">90%</dimen>
<dimen name="autofill_dataset_picker_max_height">90%</dimen>
+ <!-- Autofill save dialog padding -->
+ <dimen name="autofill_save_outer_top_margin">32dp</dimen>
+ <dimen name="autofill_save_outer_top_padding">16dp</dimen>
+ <dimen name="autofill_elevation">32dp</dimen>
+ <dimen name="autofill_save_inner_padding">16dp</dimen>
+ <dimen name="autofill_save_icon_size">24dp</dimen>
+ <dimen name="autofill_save_title_start_padding">8dp</dimen>
+ <dimen name="autofill_save_scroll_view_top_margin">4dp</dimen>
+ <dimen name="autofill_save_button_bar_padding">16dp</dimen>
+
<!-- Max height of the the autofill save custom subtitle as a fraction of the screen width/height -->
<dimen name="autofill_save_custom_subtitle_max_height">20%</dimen>
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index 7de6ca5..37678dd 100644
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -1561,7 +1561,7 @@
<!-- Error message shown when the face hardware can't be accessed. [CHAR LIMIT=69] -->
<string name="face_error_hw_not_available">Can\u2019t verify face. Hardware not available.</string>
<!-- Error message shown when the face hardware timer has expired and the user needs to restart the operation. [CHAR LIMIT=50] -->
- <string name="face_error_timeout">Face timeout reached. Try again.</string>
+ <string name="face_error_timeout">Try face authentication again.</string>
<!-- Error message shown when the face hardware has run out of room for storing faces. [CHAR LIMIT=69] -->
<string name="face_error_no_space">Can\u2019t store new face data. Delete an old one first.</string>
<!-- Generic error message shown when the face operation (e.g. enrollment or authentication) is canceled. Generally not shown to the user. [CHAR LIMIT=50] -->
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index 1ef2eb4..3a348f0 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -2279,6 +2279,8 @@
<java-symbol type="bool" name="config_alwaysUseCdmaRssi" />
<java-symbol type="dimen" name="status_bar_icon_size" />
+ <java-symbol type="dimen" name="status_bar_system_icon_size" />
+ <java-symbol type="dimen" name="status_bar_system_icon_intrinsic_size" />
<java-symbol type="drawable" name="list_selector_pressed_holo_dark" />
<java-symbol type="drawable" name="scrubber_control_disabled_holo" />
<java-symbol type="drawable" name="scrubber_control_selector_holo" />
diff --git a/packages/DynamicSystemInstallationService/src/com/android/dynsystem/DynamicSystemInstallationService.java b/packages/DynamicSystemInstallationService/src/com/android/dynsystem/DynamicSystemInstallationService.java
index 43d7d8f..e731b45 100644
--- a/packages/DynamicSystemInstallationService/src/com/android/dynsystem/DynamicSystemInstallationService.java
+++ b/packages/DynamicSystemInstallationService/src/com/android/dynsystem/DynamicSystemInstallationService.java
@@ -70,6 +70,10 @@
private static final String TAG = "DynSystemInstallationService";
+
+ // TODO (b/131866826): This is currently for test only. Will move this to System API.
+ static final String KEY_ENABLE_WHEN_COMPLETED = "KEY_ENABLE_WHEN_COMPLETED";
+
/*
* Intent actions
*/
@@ -122,6 +126,9 @@
private long mInstalledSize;
private boolean mJustCancelledByUser;
+ // This is for testing only now
+ private boolean mEnableWhenCompleted;
+
private InstallationAsyncTask mInstallTask;
@@ -178,6 +185,11 @@
public void onResult(int result, Throwable detail) {
if (result == RESULT_OK) {
postStatus(STATUS_READY, CAUSE_INSTALL_COMPLETED, null);
+
+ // For testing: enable DSU and restart the device when install completed
+ if (mEnableWhenCompleted) {
+ executeRebootToDynSystemCommand();
+ }
return;
}
@@ -224,6 +236,7 @@
String url = intent.getDataString();
mSystemSize = intent.getLongExtra(DynamicSystemClient.KEY_SYSTEM_SIZE, 0);
mUserdataSize = intent.getLongExtra(DynamicSystemClient.KEY_USERDATA_SIZE, 0);
+ mEnableWhenCompleted = intent.getBooleanExtra(KEY_ENABLE_WHEN_COMPLETED, false);
mInstallTask = new InstallationAsyncTask(
url, mSystemSize, mUserdataSize, this, mDynSystem, this);
@@ -275,7 +288,7 @@
private void executeRebootToDynSystemCommand() {
boolean enabled = false;
- if (mInstallTask != null && mInstallTask.getStatus() == FINISHED) {
+ if (mInstallTask != null && mInstallTask.getResult() == RESULT_OK) {
enabled = mInstallTask.commit();
} else if (isDynamicSystemInstalled()) {
enabled = mDynSystem.setEnable(true);
diff --git a/packages/DynamicSystemInstallationService/src/com/android/dynsystem/VerificationActivity.java b/packages/DynamicSystemInstallationService/src/com/android/dynsystem/VerificationActivity.java
index b1c09381..8a2948b 100644
--- a/packages/DynamicSystemInstallationService/src/com/android/dynsystem/VerificationActivity.java
+++ b/packages/DynamicSystemInstallationService/src/com/android/dynsystem/VerificationActivity.java
@@ -92,6 +92,8 @@
Uri url = callingIntent.getData();
long systemSize = callingIntent.getLongExtra(KEY_SYSTEM_SIZE, 0);
long userdataSize = callingIntent.getLongExtra(KEY_USERDATA_SIZE, 0);
+ boolean enableWhenCompleted = callingIntent.getBooleanExtra(
+ DynamicSystemInstallationService.KEY_ENABLE_WHEN_COMPLETED, false);
sVerifiedUrl = url.toString();
@@ -101,6 +103,8 @@
intent.setAction(DynamicSystemClient.ACTION_START_INSTALL);
intent.putExtra(KEY_SYSTEM_SIZE, systemSize);
intent.putExtra(KEY_USERDATA_SIZE, userdataSize);
+ intent.putExtra(
+ DynamicSystemInstallationService.KEY_ENABLE_WHEN_COMPLETED, enableWhenCompleted);
Log.d(TAG, "Starting Installation Service");
startServiceAsUser(intent, UserHandle.SYSTEM);
diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java
index 1d351a5..9a95288 100644
--- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java
+++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java
@@ -826,11 +826,22 @@
}
/**
- * @return resource for string that discribes the connection state of this device.
- * case 1: idle or playing media, show "Active" on the only one A2DP active device.
- * case 2: in phone call, show "Active" on the only one HFP active device
+ * Return full summary that describes connection state of this device
+ *
+ * @see #getConnectionSummary(boolean shortSummary)
*/
public String getConnectionSummary() {
+ return getConnectionSummary(false /* shortSummary */);
+ }
+
+ /**
+ * Return summary that describes connection state of this device. Summary depends on:
+ * 1. Whether device has battery info
+ * 2. Whether device is in active usage(or in phone call)
+ *
+ * @param shortSummary {@code true} if need to return short version summary
+ */
+ public String getConnectionSummary(boolean shortSummary) {
boolean profileConnected = false; // Updated as long as BluetoothProfile is connected
boolean a2dpConnected = true; // A2DP is connected
boolean hfpConnected = true; // HFP is connected
@@ -909,9 +920,9 @@
if ((mIsActiveDeviceHearingAid)
|| (mIsActiveDeviceHeadset && isOnCall)
|| (mIsActiveDeviceA2dp && !isOnCall)) {
- if (isTwsBatteryAvailable(leftBattery, rightBattery)) {
+ if (isTwsBatteryAvailable(leftBattery, rightBattery) && !shortSummary) {
stringRes = R.string.bluetooth_active_battery_level_untethered;
- } else if (batteryLevelPercentageString != null) {
+ } else if (batteryLevelPercentageString != null && !shortSummary) {
stringRes = R.string.bluetooth_active_battery_level;
} else {
stringRes = R.string.bluetooth_active_no_battery_level;
diff --git a/packages/SettingsLib/tests/robotests/src/com/android/settingslib/bluetooth/CachedBluetoothDeviceTest.java b/packages/SettingsLib/tests/robotests/src/com/android/settingslib/bluetooth/CachedBluetoothDeviceTest.java
index c0a1f11..93dcbfe 100644
--- a/packages/SettingsLib/tests/robotests/src/com/android/settingslib/bluetooth/CachedBluetoothDeviceTest.java
+++ b/packages/SettingsLib/tests/robotests/src/com/android/settingslib/bluetooth/CachedBluetoothDeviceTest.java
@@ -192,6 +192,27 @@
}
@Test
+ public void getConnectionSummary_shortSummary_returnShortSummary() {
+ // Test without battery level
+ // Set A2DP profile to be connected and test connection state summary
+ updateProfileStatus(mA2dpProfile, BluetoothProfile.STATE_CONNECTED);
+ assertThat(mCachedDevice.getConnectionSummary(true /* shortSummary */)).isNull();
+
+ // Set device as Active for A2DP and test connection state summary
+ mCachedDevice.onActiveDeviceChanged(true, BluetoothProfile.A2DP);
+ assertThat(mCachedDevice.getConnectionSummary(true /* shortSummary */)).isEqualTo("Active");
+
+ // Test with battery level
+ mBatteryLevel = 10;
+ assertThat(mCachedDevice.getConnectionSummary(true /* shortSummary */)).isEqualTo(
+ "Active");
+
+ // Set A2DP profile to be disconnected and test connection state summary
+ updateProfileStatus(mA2dpProfile, BluetoothProfile.STATE_DISCONNECTED);
+ assertThat(mCachedDevice.getConnectionSummary()).isNull();
+ }
+
+ @Test
public void getConnectionSummary_testA2dpBatteryInactive_returnBattery() {
// Arrange:
// 1. Profile: {A2DP, CONNECTED, Inactive}
diff --git a/packages/SystemUI/res/layout-land/global_actions_grid.xml b/packages/SystemUI/res/layout-land/global_actions_grid.xml
index 86b103d..4619430 100644
--- a/packages/SystemUI/res/layout-land/global_actions_grid.xml
+++ b/packages/SystemUI/res/layout-land/global_actions_grid.xml
@@ -6,16 +6,15 @@
android:layout_height="match_parent"
android:orientation="horizontal"
android:theme="@style/qs_theme"
- android:gravity="right"
+ android:gravity="right | center_vertical"
android:clipChildren="false"
android:clipToPadding="false"
android:paddingRight="@dimen/global_actions_grid_container_shadow_offset"
android:layout_marginRight="@dimen/global_actions_grid_container_negative_shadow_offset"
>
<LinearLayout
- android:layout_height="match_parent"
+ android:layout_height="wrap_content"
android:layout_width="wrap_content"
- android:gravity="top|right"
android:orientation="vertical"
android:layout_marginRight="@dimen/global_actions_grid_container_bottom_margin"
android:clipChildren="false"
diff --git a/packages/SystemUI/res/layout-land/global_actions_grid_seascape.xml b/packages/SystemUI/res/layout-land/global_actions_grid_seascape.xml
index 4c3fcc0..4ece03b 100644
--- a/packages/SystemUI/res/layout-land/global_actions_grid_seascape.xml
+++ b/packages/SystemUI/res/layout-land/global_actions_grid_seascape.xml
@@ -6,16 +6,15 @@
android:layout_height="match_parent"
android:orientation="horizontal"
android:theme="@style/qs_theme"
- android:gravity="left"
+ android:gravity="left | center_vertical"
android:clipChildren="false"
android:clipToPadding="false"
android:paddingLeft="@dimen/global_actions_grid_container_shadow_offset"
android:layout_marginLeft="@dimen/global_actions_grid_container_negative_shadow_offset"
>
<LinearLayout
- android:layout_height="match_parent"
+ android:layout_height="wrap_content"
android:layout_width="wrap_content"
- android:gravity="bottom|left"
android:padding="0dp"
android:orientation="vertical"
android:clipChildren="false"
diff --git a/packages/SystemUI/res/layout/global_actions_grid.xml b/packages/SystemUI/res/layout/global_actions_grid.xml
index 43e6b49..3928062 100644
--- a/packages/SystemUI/res/layout/global_actions_grid.xml
+++ b/packages/SystemUI/res/layout/global_actions_grid.xml
@@ -6,7 +6,7 @@
android:layout_height="match_parent"
android:orientation="horizontal"
android:theme="@style/qs_theme"
- android:gravity="bottom"
+ android:gravity="bottom | center_horizontal"
android:clipChildren="false"
android:clipToPadding="false"
android:paddingBottom="@dimen/global_actions_grid_container_shadow_offset"
@@ -14,8 +14,7 @@
>
<LinearLayout
android:layout_height="wrap_content"
- android:layout_width="match_parent"
- android:gravity="bottom | right"
+ android:layout_width="wrap_content"
android:layoutDirection="ltr"
android:clipChildren="false"
android:clipToPadding="false"
diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml
index 6dbc385..aecae63 100644
--- a/packages/SystemUI/res/values/dimens.xml
+++ b/packages/SystemUI/res/values/dimens.xml
@@ -89,7 +89,7 @@
<dimen name="status_bar_wifi_signal_spacer_width">2.5dp</dimen>
<!-- Size of the view displaying the wifi signal icon in the status bar. -->
- <dimen name="status_bar_wifi_signal_size">15dp</dimen>
+ <dimen name="status_bar_wifi_signal_size">@*android:dimen/status_bar_system_icon_size</dimen>
<!-- Spacing before the airplane mode icon if there are any icons preceding it. -->
<dimen name="status_bar_airplane_spacer_width">4dp</dimen>
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardPatternView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardPatternView.java
index 55499da..0e91e41 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardPatternView.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardPatternView.java
@@ -68,6 +68,9 @@
private final AppearAnimationUtils mAppearAnimationUtils;
private final DisappearAnimationUtils mDisappearAnimationUtils;
private final DisappearAnimationUtils mDisappearAnimationUtilsLocked;
+ private final int[] mTmpPosition = new int[2];
+ private final Rect mTempRect = new Rect();
+ private final Rect mLockPatternScreenBounds = new Rect();
private CountDownTimer mCountdownTimer = null;
private LockPatternUtils mLockPatternUtils;
@@ -92,7 +95,6 @@
mLockPatternView.clearPattern();
}
};
- private Rect mTempRect = new Rect();
@VisibleForTesting
KeyguardMessageArea mSecurityMessageDisplay;
private View mEcaView;
@@ -199,6 +201,15 @@
}
@Override
+ protected void onLayout(boolean changed, int l, int t, int r, int b) {
+ super.onLayout(changed, l, t, r, b);
+ mLockPatternView.getLocationOnScreen(mTmpPosition);
+ mLockPatternScreenBounds.set(mTmpPosition[0], mTmpPosition[1],
+ mTmpPosition[0] + mLockPatternView.getWidth(),
+ mTmpPosition[1] + mLockPatternView.getHeight());
+ }
+
+ @Override
public void reset() {
// reset lock pattern
mLockPatternView.setInStealthMode(!mLockPatternUtils.isVisiblePatternEnabled(
@@ -233,9 +244,7 @@
@Override
public boolean disallowInterceptTouch(MotionEvent event) {
- mTempRect.set(mLockPatternView.getLeft(), mLockPatternView.getTop(),
- mLockPatternView.getRight(), mLockPatternView.getBottom());
- return mTempRect.contains((int) event.getX(), (int) event.getY());
+ return mLockPatternScreenBounds.contains((int) event.getRawX(), (int) event.getRawY());
}
/** TODO: hook this up */
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/WorkLockActivity.java b/packages/SystemUI/src/com/android/systemui/keyguard/WorkLockActivity.java
index af2b767..a9fe54b 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/WorkLockActivity.java
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/WorkLockActivity.java
@@ -21,7 +21,6 @@
import android.annotation.ColorInt;
import android.annotation.UserIdInt;
import android.app.Activity;
-import android.app.ActivityManager;
import android.app.ActivityOptions;
import android.app.KeyguardManager;
import android.app.PendingIntent;
@@ -32,9 +31,7 @@
import android.content.IntentFilter;
import android.graphics.Color;
import android.os.Bundle;
-import android.os.RemoteException;
import android.os.UserHandle;
-import android.util.Log;
import android.view.View;
import com.android.internal.annotations.VisibleForTesting;
@@ -56,7 +53,9 @@
*/
static final String EXTRA_TASK_DESCRIPTION =
"com.android.systemui.keyguard.extra.TASK_DESCRIPTION";
-
+
+ private static final int REQUEST_CODE_CONFIRM_CREDENTIALS = 1;
+
/**
* Cached keyguard manager instance populated by {@link #getKeyguardManager}.
* @see KeyguardManager
@@ -111,7 +110,6 @@
@Override
public void onBackPressed() {
// Ignore back presses.
- return;
}
@Override
@@ -151,26 +149,26 @@
PendingIntent.FLAG_ONE_SHOT |
PendingIntent.FLAG_IMMUTABLE, options.toBundle());
- credential.putExtra(Intent.EXTRA_INTENT, target.getIntentSender());
- try {
- ActivityManager.getService().startConfirmDeviceCredentialIntent(credential,
- getChallengeOptions().toBundle());
- } catch (RemoteException e) {
- Log.e(TAG, "Failed to start confirm credential intent", e);
+ if (target != null) {
+ credential.putExtra(Intent.EXTRA_INTENT, target.getIntentSender());
+ }
+
+ startActivityForResult(credential, REQUEST_CODE_CONFIRM_CREDENTIALS);
+ }
+
+ @Override
+ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
+ if (requestCode == REQUEST_CODE_CONFIRM_CREDENTIALS && resultCode != RESULT_OK) {
+ // The user dismissed the challenge, don't show it again.
+ goToHomeScreen();
}
}
- private ActivityOptions getChallengeOptions() {
- // If we are taking up the whole screen, just use the default animation of clipping the
- // credentials activity into the entire foreground.
- if (!isInMultiWindowMode()) {
- return ActivityOptions.makeBasic();
- }
-
- // Otherwise, animate the transition from this part of the screen to fullscreen
- // using our own decor as the starting position.
- final View view = getWindow().getDecorView();
- return ActivityOptions.makeScaleUpAnimation(view, 0, 0, view.getWidth(), view.getHeight());
+ private void goToHomeScreen() {
+ final Intent homeIntent = new Intent(Intent.ACTION_MAIN);
+ homeIntent.addCategory(Intent.CATEGORY_HOME);
+ homeIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ startActivity(homeIntent);
}
private KeyguardManager getKeyguardManager() {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java
index 033c4fb..6552fe6 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java
@@ -40,7 +40,6 @@
import android.service.notification.StatusBarNotification;
import android.text.TextUtils;
import android.util.AttributeSet;
-import android.util.DisplayMetrics;
import android.util.FloatProperty;
import android.util.Log;
import android.util.Property;
@@ -72,12 +71,12 @@
/**
* Status icons are currently drawn with the intention of being 17dp tall, but we
* want to scale them (in a way that doesn't require an asset dump) down 2dp. So
- * 17dp * (15 / 17) = 15dp, the new height.
+ * 17dp * (15 / 17) = 15dp, the new height. After the first call to {@link #reloadDimens} all
+ * values will be in px.
*/
- private static final float SYSTEM_ICON_DESIRED_HEIGHT = 15f;
- private static final float SYSTEM_ICON_INTRINSIC_HEIGHT = 17f;
- private static final float SYSTEM_ICON_SCALE =
- SYSTEM_ICON_DESIRED_HEIGHT / SYSTEM_ICON_INTRINSIC_HEIGHT;
+ private float mSystemIconDesiredHeight = 15f;
+ private float mSystemIconIntrinsicHeight = 17f;
+ private float mSystemIconDefaultScale = mSystemIconDesiredHeight / mSystemIconIntrinsicHeight;
private final int ANIMATION_DURATION_FAST = 100;
public static final int STATE_ICON = 0;
@@ -209,21 +208,20 @@
// Makes sure that all icons are scaled to the same height (15dp). If we cannot get a height
// for the icon, it uses the default SCALE (15f / 17f) which is the old behavior
private void updateIconScaleForSystemIcons() {
- float iconHeight = getIconHeightInDps();
+ float iconHeight = getIconHeight();
if (iconHeight != 0) {
- mIconScale = SYSTEM_ICON_DESIRED_HEIGHT / iconHeight;
+ mIconScale = mSystemIconDesiredHeight / iconHeight;
} else {
- mIconScale = SYSTEM_ICON_SCALE;
+ mIconScale = mSystemIconDefaultScale;
}
}
- private float getIconHeightInDps() {
+ private float getIconHeight() {
Drawable d = getDrawable();
if (d != null) {
- return ((float) getDrawable().getIntrinsicHeight() * DisplayMetrics.DENSITY_DEFAULT)
- / mDensity;
+ return (float) getDrawable().getIntrinsicHeight();
} else {
- return SYSTEM_ICON_INTRINSIC_HEIGHT;
+ return mSystemIconIntrinsicHeight;
}
}
@@ -265,6 +263,11 @@
if (applyRadius) {
mDotRadius = mStaticDotRadius;
}
+ mSystemIconDesiredHeight = res.getDimension(
+ com.android.internal.R.dimen.status_bar_system_icon_size);
+ mSystemIconIntrinsicHeight = res.getDimension(
+ com.android.internal.R.dimen.status_bar_system_icon_intrinsic_size);
+ mSystemIconDefaultScale = mSystemIconDesiredHeight / mSystemIconIntrinsicHeight;
}
public void setNotification(StatusBarNotification notification) {
@@ -272,6 +275,7 @@
if (notification != null) {
setContentDescription(notification.getNotification());
}
+ maybeUpdateIconScaleDimens();
}
public StatusBarIconView(Context context, AttributeSet attrs) {
@@ -280,7 +284,7 @@
mBlocked = false;
mAlwaysScaleIcon = true;
reloadDimens();
- updateIconScaleForNotifications();
+ maybeUpdateIconScaleDimens();
mDensity = context.getResources().getDisplayMetrics().densityDpi;
}
@@ -854,7 +858,7 @@
public void setDark(boolean dark, boolean fade, long delay) {
mDozer.setIntensityDark(f -> {
mDarkAmount = f;
- updateIconScaleForNotifications();
+ maybeUpdateIconScaleDimens();
updateDecorColor();
updateIconColor();
updateAllowAnimation();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java
index f93c5f0..a3e3426 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java
@@ -46,6 +46,7 @@
import com.android.systemui.statusbar.KeyguardAffordanceView;
import com.android.systemui.statusbar.policy.AccessibilityController;
import com.android.systemui.statusbar.policy.ConfigurationController;
+import com.android.systemui.statusbar.policy.KeyguardMonitor;
import com.android.systemui.statusbar.policy.UserInfoController.OnUserInfoChangedListener;
import javax.inject.Inject;
@@ -71,6 +72,7 @@
private final AccessibilityController mAccessibilityController;
private final DockManager mDockManager;
private final Handler mMainHandler;
+ private final KeyguardMonitor mKeyguardMonitor;
private int mLastState = 0;
private boolean mTransientBiometricsError;
@@ -91,7 +93,16 @@
private int mIconRes;
private boolean mWasPulsingOnThisFrame;
private boolean mWakeAndUnlockRunning;
+ private boolean mKeyguardShowing;
+ private final KeyguardMonitor.Callback mKeyguardMonitorCallback =
+ new KeyguardMonitor.Callback() {
+ @Override
+ public void onKeyguardShowingChanged() {
+ mKeyguardShowing = mKeyguardMonitor.isShowing();
+ update(false /* force */);
+ }
+ };
private final Runnable mDrawOffTimeout = () -> update(true /* forceUpdate */);
private final DockManager.DockEventListener mDockEventListener =
new DockManager.DockEventListener() {
@@ -150,6 +161,7 @@
StatusBarStateController statusBarStateController,
ConfigurationController configurationController,
AccessibilityController accessibilityController,
+ KeyguardMonitor keyguardMonitor,
@Nullable DockManager dockManager,
@Named(MAIN_HANDLER_NAME) Handler mainHandler) {
super(context, attrs);
@@ -159,6 +171,7 @@
mAccessibilityController = accessibilityController;
mConfigurationController = configurationController;
mStatusBarStateController = statusBarStateController;
+ mKeyguardMonitor = keyguardMonitor;
mDockManager = dockManager;
mMainHandler = mainHandler;
}
@@ -168,6 +181,7 @@
super.onAttachedToWindow();
mStatusBarStateController.addCallback(this);
mConfigurationController.addCallback(this);
+ mKeyguardMonitor.addCallback(mKeyguardMonitorCallback);
mKeyguardUpdateMonitor.registerCallback(mUpdateMonitorCallback);
mUnlockMethodCache.addListener(this);
mSimLocked = mKeyguardUpdateMonitor.isSimPinSecure();
@@ -183,6 +197,7 @@
mStatusBarStateController.removeCallback(this);
mConfigurationController.removeCallback(this);
mKeyguardUpdateMonitor.removeCallback(mUpdateMonitorCallback);
+ mKeyguardMonitor.removeCallback(mKeyguardMonitorCallback);
mUnlockMethodCache.removeListener(this);
if (mDockManager != null) {
mDockManager.removeListener(mDockEventListener);
@@ -379,7 +394,7 @@
KeyguardUpdateMonitor updateMonitor = KeyguardUpdateMonitor.getInstance(mContext);
if (mTransientBiometricsError) {
return STATE_BIOMETRICS_ERROR;
- } else if (mUnlockMethodCache.canSkipBouncer() && !mSimLocked) {
+ } else if ((mUnlockMethodCache.canSkipBouncer() || !mKeyguardShowing) && !mSimLocked) {
return STATE_LOCK_OPEN;
} else if (updateMonitor.isFaceDetectionRunning()) {
return STATE_SCANNING_FACE;
diff --git a/proto/src/metrics_constants/metrics_constants.proto b/proto/src/metrics_constants/metrics_constants.proto
index 5fd14a3..a5a4fec 100644
--- a/proto/src/metrics_constants/metrics_constants.proto
+++ b/proto/src/metrics_constants/metrics_constants.proto
@@ -7294,6 +7294,7 @@
ACTION_VERIFY_SLICE_OTHER_EXCEPTION = 1727;
// ---- Skipping ahead to avoid conflicts between master and release branches.
+
// OPEN: Settings > System > Gestures > Global Actions Panel
// CATEGORY: SETTINGS
// OS: Q
diff --git a/services/core/java/com/android/server/wm/ActivityRecord.java b/services/core/java/com/android/server/wm/ActivityRecord.java
index 1344727..66b305e 100644
--- a/services/core/java/com/android/server/wm/ActivityRecord.java
+++ b/services/core/java/com/android/server/wm/ActivityRecord.java
@@ -1085,6 +1085,22 @@
if (root == this) {
task.setRootProcess(proc);
}
+ // Override the process configuration to match the display where the first activity in
+ // the process was launched. This can help with compat issues on secondary displays when
+ // apps use Application to obtain configuration or metrics instead of Activity.
+ final ActivityDisplay display = getDisplay();
+ if (display == null || display.mDisplayId == INVALID_DISPLAY) {
+ return;
+ }
+ if (!proc.hasActivities() && display.mDisplayId != DEFAULT_DISPLAY) {
+ proc.registerDisplayConfigurationListenerLocked(display);
+ } else if (display.mDisplayId == DEFAULT_DISPLAY) {
+ // Once an activity is launched on default display - stop listening for other displays
+ // configurations to maintain compatibility with previous platform releases. E.g. when
+ // an activity is launched in a Bubble and then moved to default screen, we should match
+ // the global device config.
+ proc.unregisterDisplayConfigurationListenerLocked();
+ }
}
boolean hasProcess() {
@@ -3233,7 +3249,7 @@
// Update last reported values.
final Configuration newMergedOverrideConfig = getMergedOverrideConfiguration();
- setLastReportedConfiguration(mAtmService.getGlobalConfiguration(), newMergedOverrideConfig);
+ setLastReportedConfiguration(getProcessGlobalConfiguration(), newMergedOverrideConfig);
if (mState == INITIALIZING) {
// No need to relaunch or schedule new config for activity that hasn't been launched
@@ -3342,6 +3358,14 @@
return true;
}
+ /** Get process configuration, or global config if the process is not set. */
+ private Configuration getProcessGlobalConfiguration() {
+ if (app != null) {
+ return app.getConfiguration();
+ }
+ return mAtmService.getGlobalConfiguration();
+ }
+
/**
* When assessing a configuration change, decide if the changes flags and the new configurations
* should cause the Activity to relaunch.
@@ -3449,7 +3473,7 @@
mStackSupervisor.activityRelaunchingLocked(this);
final ClientTransactionItem callbackItem = ActivityRelaunchItem.obtain(pendingResults,
pendingNewIntents, configChangeFlags,
- new MergedConfiguration(mAtmService.getGlobalConfiguration(),
+ new MergedConfiguration(getProcessGlobalConfiguration(),
getMergedOverrideConfiguration()),
preserveWindow);
final ActivityLifecycleItem lifecycleItem;
diff --git a/services/core/java/com/android/server/wm/ActivityStartInterceptor.java b/services/core/java/com/android/server/wm/ActivityStartInterceptor.java
index 1cdb49d..9d08e10 100644
--- a/services/core/java/com/android/server/wm/ActivityStartInterceptor.java
+++ b/services/core/java/com/android/server/wm/ActivityStartInterceptor.java
@@ -280,13 +280,6 @@
mActivityOptions = ActivityOptions.makeBasic();
}
- ActivityRecord homeActivityRecord = mRootActivityContainer.getDefaultDisplayHomeActivity();
- if (homeActivityRecord != null && homeActivityRecord.getTaskRecord() != null) {
- // Showing credential confirmation activity in home task to avoid stopping
- // multi-windowed mode after showing the full-screen credential confirmation activity.
- mActivityOptions.setLaunchTaskId(homeActivityRecord.getTaskRecord().taskId);
- }
-
final UserInfo parent = mUserManager.getProfileParent(mUserId);
mRInfo = mSupervisor.resolveIntent(mIntent, mResolvedType, parent.id, 0, mRealCallingUid);
mAInfo = mSupervisor.resolveActivity(mIntent, mRInfo, mStartFlags, null /*profilerInfo*/);
diff --git a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
index 89962a5..772e5e6 100644
--- a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
+++ b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
@@ -39,7 +39,6 @@
import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED;
import static android.content.Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS;
import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
-import static android.content.Intent.FLAG_ACTIVITY_TASK_ON_HOME;
import static android.content.pm.ApplicationInfo.FLAG_FACTORY_TEST;
import static android.content.pm.ConfigurationInfo.GL_ES_VERSION_UNDEFINED;
import static android.content.pm.PackageManager.FEATURE_ACTIVITIES_ON_SECONDARY_DISPLAYS;
@@ -6892,15 +6891,9 @@
synchronized (mGlobalLock) {
final long ident = Binder.clearCallingIdentity();
try {
- intent.addFlags(FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS |
- FLAG_ACTIVITY_TASK_ON_HOME);
- ActivityOptions activityOptions = options != null
+ intent.addFlags(FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
+ final ActivityOptions activityOptions = options != null
? new ActivityOptions(options) : ActivityOptions.makeBasic();
- final ActivityRecord homeActivity =
- mRootActivityContainer.getDefaultDisplayHomeActivity();
- if (homeActivity != null) {
- activityOptions.setLaunchTaskId(homeActivity.getTaskRecord().taskId);
- }
mContext.startActivityAsUser(intent, activityOptions.toBundle(),
UserHandle.CURRENT);
} finally {
diff --git a/services/core/java/com/android/server/wm/LockTaskController.java b/services/core/java/com/android/server/wm/LockTaskController.java
index ef2a21d..b30da5e 100644
--- a/services/core/java/com/android/server/wm/LockTaskController.java
+++ b/services/core/java/com/android/server/wm/LockTaskController.java
@@ -819,7 +819,7 @@
} catch (Settings.SettingNotFoundException e) {
// Log to SafetyNet for b/127605586
android.util.EventLog.writeEvent(0x534e4554, "127605586", -1, "");
- return mLockPatternUtils.isSecure(USER_CURRENT);
+ return getLockPatternUtils().isSecure(USER_CURRENT);
}
}
diff --git a/services/core/java/com/android/server/wm/TaskStack.java b/services/core/java/com/android/server/wm/TaskStack.java
index ab5e071..d838691 100644
--- a/services/core/java/com/android/server/wm/TaskStack.java
+++ b/services/core/java/com/android/server/wm/TaskStack.java
@@ -319,7 +319,8 @@
* Sets the bounds animation target bounds ahead of an animation. This can't currently be done
* in onAnimationStart() since that is started on the UiThread.
*/
- void setAnimationFinalBounds(Rect sourceHintBounds, Rect destBounds, boolean toFullscreen) {
+ private void setAnimationFinalBounds(Rect sourceHintBounds, Rect destBounds,
+ boolean toFullscreen) {
mBoundsAnimatingRequested = true;
mBoundsAnimatingToFullscreen = toFullscreen;
if (destBounds != null) {
@@ -329,7 +330,11 @@
}
if (sourceHintBounds != null) {
mBoundsAnimationSourceHintBounds.set(sourceHintBounds);
- } else {
+ } else if (!mBoundsAnimating) {
+ // If the bounds are already animating, we don't want to reset the source hint. This is
+ // because the source hint is sent when starting the animation from the client that
+ // requested to enter pip. Other requests can adjust the pip bounds during an animation,
+ // but could accidentally reset the source hint bounds.
mBoundsAnimationSourceHintBounds.setEmpty();
}
diff --git a/services/core/java/com/android/server/wm/WindowProcessController.java b/services/core/java/com/android/server/wm/WindowProcessController.java
index 12b62b9..5fc3997 100644
--- a/services/core/java/com/android/server/wm/WindowProcessController.java
+++ b/services/core/java/com/android/server/wm/WindowProcessController.java
@@ -439,7 +439,10 @@
@Override
protected ConfigurationContainer getParent() {
- return null;
+ // Returning RootActivityContainer as the parent, so that this process controller always
+ // has full configuration and overrides (e.g. from display) are always added on top of
+ // global config.
+ return mAtm.mRootActivityContainer;
}
@HotPath(caller = HotPath.PROCESS_CHANGE)
diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java
index 5ef184a..c35e866 100644
--- a/services/core/java/com/android/server/wm/WindowState.java
+++ b/services/core/java/com/android/server/wm/WindowState.java
@@ -3104,7 +3104,7 @@
if (DEBUG_RESIZE || DEBUG_ORIENTATION) Slog.v(TAG, "Reporting new frame to " + this
+ ": " + mWindowFrames.mCompatFrame);
final MergedConfiguration mergedConfiguration =
- new MergedConfiguration(mWmService.mRoot.getConfiguration(),
+ new MergedConfiguration(getProcessGlobalConfiguration(),
getMergedOverrideConfiguration());
setLastReportedMergedConfiguration(mergedConfiguration);
diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/SecurityLogMonitor.java b/services/devicepolicy/java/com/android/server/devicepolicy/SecurityLogMonitor.java
index fb34913..1ab3b98 100644
--- a/services/devicepolicy/java/com/android/server/devicepolicy/SecurityLogMonitor.java
+++ b/services/devicepolicy/java/com/android/server/devicepolicy/SecurityLogMonitor.java
@@ -349,7 +349,7 @@
lastPos++;
} else {
// Two events have the same timestamp, check if they are the same.
- if (lastEvent.equals(curEvent)) {
+ if (lastEvent.eventEquals(curEvent)) {
// Actual overlap, just skip the event.
if (DEBUG) Slog.d(TAG, "Skipped dup event with timestamp: " + lastNanos);
} else {
diff --git a/services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java b/services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java
index 11a177a..f8fd64a 100644
--- a/services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java
@@ -16,6 +16,8 @@
package com.android.server.wm;
+import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD;
+import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED;
import static android.view.Display.DEFAULT_DISPLAY;
import static android.view.Surface.ROTATION_0;
import static android.view.Surface.ROTATION_90;
@@ -38,6 +40,7 @@
import static com.android.server.wm.ActivityStack.STACK_VISIBILITY_INVISIBLE;
import static com.android.server.wm.ActivityStack.STACK_VISIBILITY_VISIBLE;
import static com.android.server.wm.ActivityStack.STACK_VISIBILITY_VISIBLE_BEHIND_TRANSLUCENT;
+import static com.android.server.wm.WindowContainer.POSITION_TOP;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -56,10 +59,10 @@
import android.content.pm.ActivityInfo;
import android.content.res.Configuration;
import android.graphics.Rect;
-import android.os.RemoteException;
import android.platform.test.annotations.Presubmit;
import android.util.MergedConfiguration;
import android.util.MutableBoolean;
+import android.view.DisplayInfo;
import android.view.IRemoteAnimationFinishedCallback;
import android.view.IRemoteAnimationRunner.Stub;
import android.view.RemoteAnimationAdapter;
@@ -598,6 +601,67 @@
assertNull(mActivity.pendingOptions);
}
+ @Test
+ public void testSetProcessOverridesConfig() {
+ final ActivityRecord defaultDisplayActivity =
+ createActivityOnDisplay(true /* defaultDisplay */, null /* process */);
+ assertFalse(defaultDisplayActivity.app.registeredForDisplayConfigChanges());
+
+ final ActivityRecord secondaryDisplayActivity =
+ createActivityOnDisplay(false /* defaultDisplay */, null /* process */);
+ assertTrue(secondaryDisplayActivity.app.registeredForDisplayConfigChanges());
+ assertEquals(secondaryDisplayActivity.getDisplay().getResolvedOverrideConfiguration(),
+ secondaryDisplayActivity.app.getRequestedOverrideConfiguration());
+
+ assertNotEquals(defaultDisplayActivity.getConfiguration(),
+ secondaryDisplayActivity.getConfiguration());
+ }
+
+ @Test
+ public void testSetProcessDoesntOverrideConfigIfAnotherActivityPresent() {
+ final ActivityRecord defaultDisplayActivity =
+ createActivityOnDisplay(true /* defaultDisplay */, null /* process */);
+ assertFalse(defaultDisplayActivity.app.registeredForDisplayConfigChanges());
+
+ final ActivityRecord secondaryDisplayActivity =
+ createActivityOnDisplay(false /* defaultDisplay */, defaultDisplayActivity.app);
+ assertFalse(secondaryDisplayActivity.app.registeredForDisplayConfigChanges());
+ }
+
+ @Test
+ public void testActivityOnDefaultDisplayClearsProcessOverride() {
+ final ActivityRecord secondaryDisplayActivity =
+ createActivityOnDisplay(false /* defaultDisplay */, null /* process */);
+ assertTrue(secondaryDisplayActivity.app.registeredForDisplayConfigChanges());
+
+ final ActivityRecord defaultDisplayActivity =
+ createActivityOnDisplay(true /* defaultDisplay */,
+ secondaryDisplayActivity.app);
+ assertFalse(defaultDisplayActivity.app.registeredForDisplayConfigChanges());
+ assertFalse(secondaryDisplayActivity.app.registeredForDisplayConfigChanges());
+ }
+
+ /**
+ * Creates an activity on display. For non-default display request it will also create a new
+ * display with custom DisplayInfo.
+ */
+ private ActivityRecord createActivityOnDisplay(boolean defaultDisplay,
+ WindowProcessController process) {
+ final ActivityDisplay display;
+ if (defaultDisplay) {
+ display = mRootActivityContainer.getDefaultDisplay();
+ } else {
+ final DisplayInfo info = new DisplayInfo();
+ info.logicalWidth = 100;
+ info.logicalHeight = 100;
+ display = addNewActivityDisplayAt(info, POSITION_TOP);
+ }
+ final TestActivityStack stack = display.createStack(WINDOWING_MODE_UNDEFINED,
+ ACTIVITY_TYPE_STANDARD, true /* onTop */);
+ final TaskRecord task = new TaskBuilder(mSupervisor).setStack(stack).build();
+ return new ActivityBuilder(mService).setTask(task).setUseProcess(process).build();
+ }
+
/** Setup {@link #mActivity} as a size-compat-mode-able activity without fixed orientation. */
private void prepareFixedAspectRatioUnresizableActivity() {
setupDisplayContentForCompatDisplayInsets();
diff --git a/services/tests/wmtests/src/com/android/server/wm/ActivityTestsBase.java b/services/tests/wmtests/src/com/android/server/wm/ActivityTestsBase.java
index 53b0add..d8c0de7 100644
--- a/services/tests/wmtests/src/com/android/server/wm/ActivityTestsBase.java
+++ b/services/tests/wmtests/src/com/android/server/wm/ActivityTestsBase.java
@@ -195,6 +195,7 @@
private ActivityStack mStack;
private int mActivityFlags;
private int mLaunchMode;
+ private WindowProcessController mWpc;
ActivityBuilder(ActivityTaskManagerService service) {
mService = service;
@@ -245,6 +246,11 @@
return this;
}
+ ActivityBuilder setUseProcess(WindowProcessController wpc) {
+ mWpc = wpc;
+ return this;
+ }
+
ActivityRecord build() {
if (mComponent == null) {
final int id = sCurrentActivityId++;
@@ -290,12 +296,18 @@
mTaskRecord.addActivityToTop(activity);
}
- final WindowProcessController wpc = new WindowProcessController(mService,
- mService.mContext.getApplicationInfo(), "name", 12345,
- UserHandle.getUserId(12345), mock(Object.class),
- mock(WindowProcessListener.class));
- wpc.setThread(mock(IApplicationThread.class));
+ final WindowProcessController wpc;
+ if (mWpc != null) {
+ wpc = mWpc;
+ } else {
+ wpc = new WindowProcessController(mService,
+ mService.mContext.getApplicationInfo(), "name", 12345,
+ UserHandle.getUserId(12345), mock(Object.class),
+ mock(WindowProcessListener.class));
+ wpc.setThread(mock(IApplicationThread.class));
+ }
activity.setProcess(wpc);
+ wpc.addActivityIfNeeded(activity);
return activity;
}
}
diff --git a/services/tests/wmtests/src/com/android/server/wm/AppWindowTokenTests.java b/services/tests/wmtests/src/com/android/server/wm/AppWindowTokenTests.java
index fe45411..8528954 100644
--- a/services/tests/wmtests/src/com/android/server/wm/AppWindowTokenTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/AppWindowTokenTests.java
@@ -153,7 +153,6 @@
@FlakyTest(bugId = 131005232)
public void testLandscapeSeascapeRotationByApp() {
// Some plumbing to get the service ready for rotation updates.
- mWm.mDisplayReady = true;
mWm.mDisplayEnabled = true;
final WindowManager.LayoutParams attrs = new WindowManager.LayoutParams(
@@ -186,7 +185,6 @@
@Test
public void testLandscapeSeascapeRotationByPolicy() {
// Some plumbing to get the service ready for rotation updates.
- mWm.mDisplayReady = true;
mWm.mDisplayEnabled = true;
final DisplayRotation spiedRotation = spy(mDisplayContent.getDisplayRotation());
@@ -379,6 +377,7 @@
}
@Test
+ @FlakyTest(bugId = 131176283)
public void testCreateRemoveStartingWindow() {
mToken.addStartingWindow(mPackageName,
android.R.style.Theme, null, "Test", 0, 0, 0, 0, null, true, true, false, true,
diff --git a/services/tests/wmtests/src/com/android/server/wm/SystemServicesTestRule.java b/services/tests/wmtests/src/com/android/server/wm/SystemServicesTestRule.java
index 366acea..427a929 100644
--- a/services/tests/wmtests/src/com/android/server/wm/SystemServicesTestRule.java
+++ b/services/tests/wmtests/src/com/android/server/wm/SystemServicesTestRule.java
@@ -41,6 +41,7 @@
import android.content.ContentResolver;
import android.content.Context;
import android.content.IntentFilter;
+import android.content.res.Configuration;
import android.database.ContentObserver;
import android.hardware.display.DisplayManagerInternal;
import android.net.Uri;
@@ -175,6 +176,12 @@
// Display creation is driven by the ActivityManagerService via
// ActivityStackSupervisor. We emulate those steps here.
mWindowManagerService.mRoot.createDisplayContent(display, mock(ActivityDisplay.class));
+ mWindowManagerService.displayReady();
+
+ final Configuration defaultDisplayConfig =
+ mWindowManagerService.computeNewConfiguration(DEFAULT_DISPLAY);
+ doReturn(defaultDisplayConfig).when(atms).getGlobalConfiguration();
+ doReturn(defaultDisplayConfig).when(atms).getGlobalConfigurationForPid(anyInt());
mMockTracker.stopTracking();
}
diff --git a/services/tests/wmtests/src/com/android/server/wm/WindowProcessControllerTests.java b/services/tests/wmtests/src/com/android/server/wm/WindowProcessControllerTests.java
index a7c84a1..7b8fba0 100644
--- a/services/tests/wmtests/src/com/android/server/wm/WindowProcessControllerTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/WindowProcessControllerTests.java
@@ -26,7 +26,9 @@
import static org.mockito.Mockito.mock;
import android.content.pm.ApplicationInfo;
+import android.content.res.Configuration;
import android.platform.test.annotations.Presubmit;
+import android.view.DisplayInfo;
import org.junit.Test;
@@ -78,6 +80,26 @@
assertEquals(INVALID_DISPLAY, wpc.getDisplayId());
}
+ @Test
+ public void testConfigurationForSecondaryScreen() {
+ final WindowProcessController wpc = new WindowProcessController(
+ mService, mock(ApplicationInfo.class), null, 0, -1, null, null);
+ //By default, the process should not listen to any display.
+ assertEquals(INVALID_DISPLAY, wpc.getDisplayId());
+
+ // Register to a new display as a listener.
+ final DisplayInfo info = new DisplayInfo();
+ info.logicalWidth = 100;
+ info.logicalHeight = 100;
+ TestActivityDisplay display = addNewActivityDisplayAt(info, WindowContainer.POSITION_TOP);
+ wpc.registerDisplayConfigurationListenerLocked(display);
+
+ assertEquals(display.mDisplayId, wpc.getDisplayId());
+ final Configuration expectedConfig = mService.mRootActivityContainer.getConfiguration();
+ expectedConfig.updateFrom(display.getConfiguration());
+ assertEquals(expectedConfig, wpc.getConfiguration());
+ }
+
private TestActivityDisplay createTestActivityDisplayInContainer() {
final TestActivityDisplay testActivityDisplay = createNewActivityDisplay();
mRootActivityContainer.addChild(testActivityDisplay, POSITION_TOP);
diff --git a/services/tests/wmtests/src/com/android/server/wm/WindowTestsBase.java b/services/tests/wmtests/src/com/android/server/wm/WindowTestsBase.java
index 3a702cb9..de28b5f 100644
--- a/services/tests/wmtests/src/com/android/server/wm/WindowTestsBase.java
+++ b/services/tests/wmtests/src/com/android/server/wm/WindowTestsBase.java
@@ -154,7 +154,6 @@
context.getDisplay().getDisplayInfo(mDisplayInfo);
mDisplayContent = createNewDisplay();
mWm.mDisplayEnabled = true;
- mWm.mDisplayReady = true;
// Set-up some common windows.
mCommonWindows = new HashSet<>();
diff --git a/telephony/java/android/telephony/CellSignalStrengthGsm.java b/telephony/java/android/telephony/CellSignalStrengthGsm.java
index 14ae689..9d732ba 100644
--- a/telephony/java/android/telephony/CellSignalStrengthGsm.java
+++ b/telephony/java/android/telephony/CellSignalStrengthGsm.java
@@ -18,6 +18,7 @@
import android.annotation.IntRange;
import android.annotation.UnsupportedAppUsage;
+import android.os.Build;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.PersistableBundle;
@@ -46,7 +47,7 @@
private int mRssi; // in dBm [-113, -51] or UNAVAILABLE
@UnsupportedAppUsage
private int mBitErrorRate; // bit error rate (0-7, 99) TS 27.007 8.5 or UNAVAILABLE
- @UnsupportedAppUsage(maxTargetSdk = android.os.Build.VERSION_CODES.O)
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
private int mTimingAdvance; // range from 0-219 or CellInfo.UNAVAILABLE if unknown
private int mLevel;
diff --git a/tools/fonts/fontchain_linter.py b/tools/fonts/fontchain_linter.py
index f191f6c..6683e2a 100755
--- a/tools/fonts/fontchain_linter.py
+++ b/tools/fonts/fontchain_linter.py
@@ -490,11 +490,6 @@
def flag_sequence(territory_code):
return tuple(0x1F1E6 + ord(ch) - ord('A') for ch in territory_code)
-UNSUPPORTED_FLAGS = frozenset({
- flag_sequence('BL'), flag_sequence('BQ'), flag_sequence('MQ'),
- flag_sequence('RE'), flag_sequence('TF'),
-})
-
EQUIVALENT_FLAGS = {
flag_sequence('BV'): flag_sequence('NO'),
flag_sequence('CP'): flag_sequence('FR'),
@@ -600,9 +595,6 @@
for first, second in SAME_FLAG_MAPPINGS:
equivalent_emoji[first] = second
- # Remove unsupported flags
- all_sequences.difference_update(UNSUPPORTED_FLAGS)
-
# Add all tag characters used in flags
sequence_pieces.update(range(0xE0030, 0xE0039 + 1))
sequence_pieces.update(range(0xE0061, 0xE007A + 1))