Merge cherrypicks of [16634161, 16660805, 16663773, 16636785, 16630306] into sc-v2-release.

Change-Id: Id2dbb9735d18687cea76640d5e1fa97509751b97
This commit is contained in:
Android Build Coastguard Worker
2022-01-20 00:47:09 +00:00
9 changed files with 42 additions and 39 deletions

View File

@@ -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) {

View File

@@ -158,6 +158,14 @@ public class LocalePickerWithRegion extends ListFragment implements SearchView.O
setListAdapter(mAdapter);
}
@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();

View File

@@ -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>

View File

@@ -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>

View File

@@ -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();

View File

@@ -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);

View File

@@ -3311,6 +3311,7 @@ public class DisplayPolicy {
}
void release() {
mDisplayContent.mTransitionController.unregisterLegacyListener(mAppTransitionListener);
mHandler.post(mGestureNavigationSettingsObserver::unregister);
}

View File

@@ -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();

View File

@@ -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() {