diff options
5 files changed, 77 insertions, 11 deletions
diff --git a/core/java/android/app/WallpaperManager.java b/core/java/android/app/WallpaperManager.java index b337396ebe5d..0ffbd63df308 100644 --- a/core/java/android/app/WallpaperManager.java +++ b/core/java/android/app/WallpaperManager.java @@ -1488,18 +1488,27 @@ public class WallpaperManager { mContext.getUserId()); if (fd != null) { FileOutputStream fos = null; - boolean ok = false; + final Bitmap tmp = BitmapFactory.decodeStream(resources.openRawResource(resid)); try { - 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(); + // 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"); + } } 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) { @@ -1741,13 +1750,22 @@ public class WallpaperManager { result, which, completion, mContext.getUserId()); if (fd != null) { FileOutputStream fos = null; + final Bitmap tmp = BitmapFactory.decodeStream(bitmapData); try { - fos = new ParcelFileDescriptor.AutoCloseOutputStream(fd); - copyStreamToWallpaperFile(bitmapData, fos); - fos.close(); - completion.waitForCompletion(); + // 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"); + } } finally { IoUtils.closeQuietly(fos); + if (tmp != null) { + tmp.recycle(); + } } } } catch (RemoteException e) { diff --git a/core/java/android/util/BoostFramework.java b/core/java/android/util/BoostFramework.java index 72c47c1647e1..6ea4dabe2ad1 100644 --- a/core/java/android/util/BoostFramework.java +++ b/core/java/android/util/BoostFramework.java @@ -100,6 +100,9 @@ public class BoostFramework { public static final int VENDOR_HINT_TAP_EVENT = 0x00001043; public static final int VENDOR_HINT_DRAG_START = 0x00001051; public static final int VENDOR_HINT_DRAG_END = 0x00001052; + //Ime Launch Boost Hint + public static final int VENDOR_HINT_IME_LAUNCH_EVENT = 0x0000109F; + //feedback hints public static final int VENDOR_FEEDBACK_WORKLOAD_TYPE = 0x00001601; public static final int VENDOR_FEEDBACK_LAUNCH_END_POINT = 0x00001602; diff --git a/core/java/android/view/inputmethod/InputMethodManager.java b/core/java/android/view/inputmethod/InputMethodManager.java index e6f103e6d53b..fede0dfa94db 100644 --- a/core/java/android/view/inputmethod/InputMethodManager.java +++ b/core/java/android/view/inputmethod/InputMethodManager.java @@ -67,6 +67,7 @@ import android.os.Trace; import android.os.UserHandle; import android.provider.Settings; import android.text.style.SuggestionSpan; +import android.util.BoostFramework; import android.util.Log; import android.util.Pools.Pool; import android.util.Pools.SimplePool; @@ -270,6 +271,11 @@ public final class InputMethodManager { */ private static final String SUBTYPE_MODE_VOICE = "voice"; + //Perf + static BoostFramework mPerfBoost = null; + static boolean IME_BOOST_ENABLED = false; + static boolean isImeBoostPropertyRead = false; + /** * Ensures that {@link #sInstance} becomes non-{@code null} for application that have directly * or indirectly relied on {@link #sInstance} via reflection or something like that. @@ -586,6 +592,20 @@ public final class InputMethodManager { ImeTracing.getInstance().triggerClientDump( "InputMethodManager.DelegateImpl#startInput", InputMethodManager.this, null /* icProto */); + + if (isImeBoostPropertyRead == false) { + mPerfBoost = new BoostFramework(); + + if (mPerfBoost != null) { + IME_BOOST_ENABLED = Boolean.parseBoolean(mPerfBoost.perfGetProp("ro.vendor.qti.sys.fw.use_ime_boost", "false")); + } + isImeBoostPropertyRead = true; + } + + if (IME_BOOST_ENABLED == true && mPerfBoost != null) { + mPerfBoost.perfEvent(BoostFramework.VENDOR_HINT_IME_LAUNCH_EVENT, null); + } + synchronized (mH) { mCurrentTextBoxAttribute = null; mCompletions = null; diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java index fec2adbbe5b3..96557f79a554 100644 --- a/services/core/java/com/android/server/pm/PackageManagerService.java +++ b/services/core/java/com/android/server/pm/PackageManagerService.java @@ -896,6 +896,13 @@ public class PackageManagerService extends IPackageManager.Stub final private HashMap<String, String> mPackagesToBeDisabled = new HashMap<>(); /** + * Tracks packages that need to be disabled for QSPA enabled taregts. + * List of packages path on the file system. + */ + final private List<String> mPackagesPathToBeDisabledForQSPA = new ArrayList<String>(); + final private boolean mQspaEnabled = SystemProperties.getBoolean("ro.config.qspa.apps", false); + + /** * Tracks new system packages [received in an OTA] that we expect to * find updated user-installed versions. Keys are package name, values * are package location. @@ -7415,6 +7422,12 @@ public class PackageManagerService extends IPackageManager.Stub readListOfPackagesToBeDisabled(); t.traceEnd(); + mPackagesPathToBeDisabledForQSPA.add("/system_ext/priv-app/SystemUI"); + mPackagesPathToBeDisabledForQSPA.add("/system_ext/priv-app/Launcher3QuickStep"); + mPackagesPathToBeDisabledForQSPA.add("/system/app/PrintSpooler"); + mPackagesPathToBeDisabledForQSPA.add("/system/priv-app/StatementService"); + mPackagesPathToBeDisabledForQSPA.add("/product/app/Calendar"); + // Create sub-components that provide services / data. Order here is important. t.traceBegin("createSubComponents"); @@ -12111,6 +12124,15 @@ public class PackageManagerService extends IPackageManager.Stub continue; } + if (mQspaEnabled) { + if (mPackagesPathToBeDisabledForQSPA != null && + mPackagesPathToBeDisabledForQSPA.contains(file.toString())) { + // Ignore entries contained in {@link #mPackagesPathToBeDisabledForQSPA} + Slog.d(TAG, "QSPA enabled ignoring package for install : " + file); + continue; + } + } + if (mPackagesToBeDisabled.values() != null && mPackagesToBeDisabled.values().contains(file.toString())) { // Ignore entries contained in {@link #mPackagesToBeDisabled} diff --git a/services/core/java/com/android/server/wm/DisplayContent.java b/services/core/java/com/android/server/wm/DisplayContent.java index 42c6dd43ebce..19df6345c22a 100644 --- a/services/core/java/com/android/server/wm/DisplayContent.java +++ b/services/core/java/com/android/server/wm/DisplayContent.java @@ -4122,6 +4122,9 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp * which controls the visibility and animation of the input method window. */ void updateImeInputAndControlTarget(WindowState target) { + if (target != null && target.mActivityRecord != null) { + target.mActivityRecord.mImeInsetsFrozenUntilStartInput = false; + } if (mImeInputTarget != target) { ProtoLog.i(WM_DEBUG_IME, "setInputMethodInputTarget %s", target); setImeInputTarget(target); |