summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-01-20 00:47:09 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-01-20 00:47:09 +0000
commitf13716cbc8e83cdedc667f8341639d8262cf2f61 (patch)
treee61a8f255a289bdc68c2443d03f7cf1e400b9776
parent11ad7ec65e2ea2fd6db2bbf7b7add95bbca62e91 (diff)
parentac8151be84e7adc3ac35f48ce4e98e44217e44e8 (diff)
downloadbase-f13716cbc8e83cdedc667f8341639d8262cf2f61.tar.gz
Merge cherrypicks of [16634161, 16660805, 16663773, 16636785, 16630306] into sc-v2-release.
Change-Id: Id2dbb9735d18687cea76640d5e1fa97509751b97
-rw-r--r--core/java/android/app/WallpaperManager.java40
-rw-r--r--core/java/com/android/internal/app/LocalePickerWithRegion.java8
-rw-r--r--packages/SystemUI/res/layout/internet_connectivity_dialog.xml18
-rw-r--r--packages/SystemUI/res/values/styles.xml3
-rw-r--r--packages/SystemUI/src/com/android/systemui/media/MediaProjectionPermissionActivity.java4
-rw-r--r--services/core/java/com/android/server/wm/DisplayContent.java2
-rw-r--r--services/core/java/com/android/server/wm/DisplayPolicy.java1
-rw-r--r--services/core/java/com/android/server/wm/TransitionController.java4
-rw-r--r--services/core/java/com/android/server/wm/WindowOrganizerController.java1
9 files changed, 42 insertions, 39 deletions
diff --git a/core/java/android/app/WallpaperManager.java b/core/java/android/app/WallpaperManager.java
index 3712caeddaf5..fca4c698c49c 100644
--- a/core/java/android/app/WallpaperManager.java
+++ b/core/java/android/app/WallpaperManager.java
@@ -1488,27 +1488,18 @@ public class WallpaperManager {
mContext.getUserId());
if (fd != null) {
FileOutputStream fos = null;
- final Bitmap tmp = BitmapFactory.decodeStream(resources.openRawResource(resid));
+ boolean ok = false;
try {
- // If the stream can't be decoded, treat it as an invalid input.
- if (tmp != null) {
- fos = new ParcelFileDescriptor.AutoCloseOutputStream(fd);
- tmp.compress(Bitmap.CompressFormat.PNG, 100, fos);
- // The 'close()' is the trigger for any server-side image manipulation,
- // so we must do that before waiting for completion.
- fos.close();
- completion.waitForCompletion();
- } else {
- throw new IllegalArgumentException(
- "Resource 0x" + Integer.toHexString(resid) + " is invalid");
- }
+ fos = new ParcelFileDescriptor.AutoCloseOutputStream(fd);
+ copyStreamToWallpaperFile(resources.openRawResource(resid), fos);
+ // The 'close()' is the trigger for any server-side image manipulation,
+ // so we must do that before waiting for completion.
+ fos.close();
+ completion.waitForCompletion();
} finally {
// Might be redundant but completion shouldn't wait unless the write
// succeeded; this is a fallback if it threw past the close+wait.
IoUtils.closeQuietly(fos);
- if (tmp != null) {
- tmp.recycle();
- }
}
}
} catch (RemoteException e) {
@@ -1750,22 +1741,13 @@ public class WallpaperManager {
result, which, completion, mContext.getUserId());
if (fd != null) {
FileOutputStream fos = null;
- final Bitmap tmp = BitmapFactory.decodeStream(bitmapData);
try {
- // If the stream can't be decoded, treat it as an invalid input.
- if (tmp != null) {
- fos = new ParcelFileDescriptor.AutoCloseOutputStream(fd);
- tmp.compress(Bitmap.CompressFormat.PNG, 100, fos);
- fos.close();
- completion.waitForCompletion();
- } else {
- throw new IllegalArgumentException("InputStream is invalid");
- }
+ fos = new ParcelFileDescriptor.AutoCloseOutputStream(fd);
+ copyStreamToWallpaperFile(bitmapData, fos);
+ fos.close();
+ completion.waitForCompletion();
} finally {
IoUtils.closeQuietly(fos);
- if (tmp != null) {
- tmp.recycle();
- }
}
}
} catch (RemoteException e) {
diff --git a/core/java/com/android/internal/app/LocalePickerWithRegion.java b/core/java/com/android/internal/app/LocalePickerWithRegion.java
index d0719eeca04e..b4ae56f23443 100644
--- a/core/java/com/android/internal/app/LocalePickerWithRegion.java
+++ b/core/java/com/android/internal/app/LocalePickerWithRegion.java
@@ -159,6 +159,14 @@ public class LocalePickerWithRegion extends ListFragment implements SearchView.O
}
@Override
+ public void onViewCreated(View view, Bundle savedInstanceState) {
+ super.onViewCreated(view, savedInstanceState);
+ // In order to make the list view work with CollapsingToolbarLayout,
+ // we have to enable the nested scrolling feature of the list view.
+ getListView().setNestedScrollingEnabled(true);
+ }
+
+ @Override
public boolean onOptionsItemSelected(MenuItem menuItem) {
int id = menuItem.getItemId();
switch (id) {
diff --git a/packages/SystemUI/res/layout/internet_connectivity_dialog.xml b/packages/SystemUI/res/layout/internet_connectivity_dialog.xml
index e69582f52ebf..f72a8dc08c9c 100644
--- a/packages/SystemUI/res/layout/internet_connectivity_dialog.xml
+++ b/packages/SystemUI/res/layout/internet_connectivity_dialog.xml
@@ -378,7 +378,8 @@
android:clickable="true"/>
</LinearLayout>
</LinearLayout>
- <FrameLayout
+
+ <LinearLayout
android:id="@+id/button_layout"
android:orientation="horizontal"
android:layout_width="match_parent"
@@ -390,9 +391,10 @@
android:clickable="false"
android:focusable="false">
- <FrameLayout
+ <LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
+ android:layout_weight="1"
android:layout_gravity="start|center_vertical"
android:orientation="vertical">
<Button
@@ -401,12 +403,13 @@
android:layout_height="wrap_content"
android:text="@string/turn_off_airplane_mode"
android:ellipsize="end"
+ android:maxLines="1"
style="@style/Widget.Dialog.Button.BorderButton"
android:clickable="true"
android:focusable="true"/>
- </FrameLayout>
+ </LinearLayout>
- <FrameLayout
+ <LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
@@ -417,10 +420,13 @@
android:layout_height="wrap_content"
android:text="@string/inline_done_button"
style="@style/Widget.Dialog.Button"
+ android:maxLines="1"
+ android:ellipsize="end"
android:clickable="true"
android:focusable="true"/>
- </FrameLayout>
- </FrameLayout>
+ </LinearLayout>
+ </LinearLayout>
+
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</LinearLayout>
diff --git a/packages/SystemUI/res/values/styles.xml b/packages/SystemUI/res/values/styles.xml
index 051a30ccb524..f26159f5176a 100644
--- a/packages/SystemUI/res/values/styles.xml
+++ b/packages/SystemUI/res/values/styles.xml
@@ -942,8 +942,9 @@
</style>
<style name="InternetDialog.NetworkSummary">
- <item name="android:layout_marginEnd">34dp</item>
+ <item name="android:layout_marginEnd">7dp</item>
<item name="android:ellipsize">end</item>
+ <item name="android:maxLines">2</item>
<item name="android:textAppearance">@style/TextAppearance.InternetDialog.Secondary</item>
</style>
diff --git a/packages/SystemUI/src/com/android/systemui/media/MediaProjectionPermissionActivity.java b/packages/SystemUI/src/com/android/systemui/media/MediaProjectionPermissionActivity.java
index 66c51d278dab..e2716e992c48 100644
--- a/packages/SystemUI/src/com/android/systemui/media/MediaProjectionPermissionActivity.java
+++ b/packages/SystemUI/src/com/android/systemui/media/MediaProjectionPermissionActivity.java
@@ -159,7 +159,9 @@ public class MediaProjectionPermissionActivity extends Activity
mDialog.getButton(DialogInterface.BUTTON_POSITIVE).setFilterTouchesWhenObscured(true);
final Window w = mDialog.getWindow();
- w.setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
+ // QS is not closed when pressing CastTile. Match the type of the dialog shown from the
+ // tile.
+ w.setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG);
w.addSystemFlags(SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS);
mDialog.show();
diff --git a/services/core/java/com/android/server/wm/DisplayContent.java b/services/core/java/com/android/server/wm/DisplayContent.java
index 40549548da62..1e31fdab30d0 100644
--- a/services/core/java/com/android/server/wm/DisplayContent.java
+++ b/services/core/java/com/android/server/wm/DisplayContent.java
@@ -1067,8 +1067,6 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
mAppTransition = new AppTransition(mWmService.mContext, mWmService, this);
mAppTransition.registerListenerLocked(mWmService.mActivityManagerAppTransitionNotifier);
- mTransitionController.registerLegacyListener(
- mWmService.mActivityManagerAppTransitionNotifier);
mAppTransition.registerListenerLocked(mFixedRotationTransitionListener);
mAppTransitionController = new AppTransitionController(mWmService, this);
mUnknownAppVisibilityController = new UnknownAppVisibilityController(mWmService, this);
diff --git a/services/core/java/com/android/server/wm/DisplayPolicy.java b/services/core/java/com/android/server/wm/DisplayPolicy.java
index ef3c5a3df84e..1ff2ebeb8c14 100644
--- a/services/core/java/com/android/server/wm/DisplayPolicy.java
+++ b/services/core/java/com/android/server/wm/DisplayPolicy.java
@@ -3311,6 +3311,7 @@ public class DisplayPolicy {
}
void release() {
+ mDisplayContent.mTransitionController.unregisterLegacyListener(mAppTransitionListener);
mHandler.post(mGestureNavigationSettingsObserver::unregister);
}
diff --git a/services/core/java/com/android/server/wm/TransitionController.java b/services/core/java/com/android/server/wm/TransitionController.java
index e05457010df8..929ec3b929b2 100644
--- a/services/core/java/com/android/server/wm/TransitionController.java
+++ b/services/core/java/com/android/server/wm/TransitionController.java
@@ -430,6 +430,10 @@ class TransitionController {
mLegacyListeners.add(listener);
}
+ void unregisterLegacyListener(WindowManagerInternal.AppTransitionListener listener) {
+ mLegacyListeners.remove(listener);
+ }
+
void dispatchLegacyAppTransitionPending() {
for (int i = 0; i < mLegacyListeners.size(); ++i) {
mLegacyListeners.get(i).onAppTransitionPendingLocked();
diff --git a/services/core/java/com/android/server/wm/WindowOrganizerController.java b/services/core/java/com/android/server/wm/WindowOrganizerController.java
index 42766bdb0732..6970c7942a50 100644
--- a/services/core/java/com/android/server/wm/WindowOrganizerController.java
+++ b/services/core/java/com/android/server/wm/WindowOrganizerController.java
@@ -137,6 +137,7 @@ class WindowOrganizerController extends IWindowOrganizerController.Stub
void setWindowManager(WindowManagerService wms) {
mTransitionController = new TransitionController(mService, wms.mTaskSnapshotController);
+ mTransitionController.registerLegacyListener(wms.mActivityManagerAppTransitionNotifier);
}
TransitionController getTransitionController() {