diff options
author | alk3pInjection <webmaster@raspii.tech> | 2022-06-29 12:32:24 +0800 |
---|---|---|
committer | alk3pInjection <webmaster@raspii.tech> | 2022-06-29 12:32:24 +0800 |
commit | 1062bc589000e7ecde7497f024e7077bc837d47d (patch) | |
tree | 98f5e916ae484030634b909af7ac7f1a51884509 /core | |
parent | 7443f9f091e5656823bdcf3465e69f014a10dc11 (diff) | |
parent | def91818e6a79701df7d0bf5e26fe884d6b2a8c9 (diff) |
Merge tag 'LA.QSSI.12.0.r1-07900.02-qssi.0' into sugisawa-mr1
"LA.QSSI.12.0.r1-07900.02-qssi.0"
Change-Id: Ie8af0b8cc073d2b8a74655a107abe33d6a414ba9
Diffstat (limited to 'core')
-rw-r--r-- | core/java/android/app/WallpaperManager.java | 40 | ||||
-rw-r--r-- | core/java/android/util/BoostFramework.java | 3 | ||||
-rw-r--r-- | core/java/android/view/inputmethod/InputMethodManager.java | 20 |
3 files changed, 52 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; |