Age | Commit message (Collapse) | Author |
|
Squashed commit of the following:
Author: Henrique Silva <jhenrique09.mcz@hotmail.com>
Date: Wed May 8 11:52:38 2019 -0300
base: SwipeToScreenshot: Import MIUI implementation
Reverse engineered from Xiaomi/beryllium/beryllium:9/PKQ1.180729.001/9.2.25:user/release-keys
Change-Id: I1d5938457b7cc4c5ef1fec235d27d8a40526961a
Author: Henrique Silva <jhenrique09.mcz@hotmail.com>
Date: Tue May 7 13:29:38 2019 -0300
base: Improvements for swipe to screenshot
* Cancel touch events when tap with three fingers
* Dyrex2004: Fix typos (Screnshot -> Screenshot)
Change-Id: I90c5d73f37f277052c4e4802fd3006f607313068
Author: ghbhaha <ghbhaha@gmail.com>
Date: Sun Aug 9 01:23:33 2015 +0800
base: Add three-fingers-swipe to screenshot [1/2]
The feature is ported from Oppo ColorOS.
With the options on, users can swipe down
on the screen to have a screenshot.
Original smali port by: wuxianlin
Change-Id: I87ed333f81e1259758ea899bf019061d8ab85fd0
Change-Id: I78c67e5470a5024034be92736a36bc43b3ca4487
|
|
Squashed commit of the following:
Author: ender1324 <ender1324@abv.bg>
Date: Thu, 4 Feb 2021 15:16:33 +0200
Fallback stitchimage's broken value to unknown
- For some reason stitchimage returns 9528, no idea why
- A proper fix would be to fix it from the apk itself but "we dont do that here"
- Thanks to kandnub for helping me find the core issue
Fixes:
02-03 22:05:46.956 10753 10753 E AndroidRuntime: java.lang.RuntimeException: Unable to create service com.asus.stitchimage.OverlayService: java.lang.IllegalArgumentException: Invalid usage 9528
02-03 22:05:46.956 10753 10753 E AndroidRuntime: at android.app.ActivityThread.handleCreateService(ActivityThread.java:4198)
02-03 22:05:46.956 10753 10753 E AndroidRuntime: at android.app.ActivityThread.access$1500(ActivityThread.java:237)
02-03 22:05:46.956 10753 10753 E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1932)
02-03 22:05:46.956 10753 10753 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:106)
02-03 22:05:46.956 10753 10753 E AndroidRuntime: at android.os.Looper.loop(Looper.java:223)
02-03 22:05:46.956 10753 10753 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:7661)
02-03 22:05:46.956 10753 10753 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
02-03 22:05:46.956 10753 10753 E AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
02-03 22:05:46.956 10753 10753 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
02-03 22:05:46.956 10753 10753 E AndroidRuntime: Caused by: java.lang.IllegalArgumentException: Invalid usage 9528
02-03 22:05:46.956 10753 10753 E AndroidRuntime: at android.media.AudioAttributes$Builder.setUsage(AudioAttributes.java:783)
02-03 22:05:46.956 10753 10753 E AndroidRuntime: at com.asus.stitchimage.f.g.b(Unknown Source:7)
02-03 22:05:46.956 10753 10753 E AndroidRuntime: at com.asus.stitchimage.f.t.a(Unknown Source:19)
02-03 22:05:46.956 10753 10753 E AndroidRuntime: at com.asus.stitchimage.OverlayService.B(Unknown Source:83)
02-03 22:05:46.956 10753 10753 E AndroidRuntime: at com.asus.stitchimage.OverlayService.onCreate(Unknown Source:73)
02-03 22:05:46.956 10753 10753 E AndroidRuntime: at android.app.ActivityThread.handleCreateService(ActivityThread.java:4186)
02-03 22:05:46.956 10753 10753 E AndroidRuntime: ... 8 more
Co-authored-by: Kandarp <kandnub@gmail.com>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Author: jhenrique09 <jhenrique09.mcz@hotmail.com>
Date: Wed, 3 Feb 2021 22:20:43 +0200
base: Whitelist stitchimage
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Author: Pranav Vashi <neobuddy89@gmail.com>
Date: Fri, 14 May 2021 20:22:34 +0530
Fix screenshot sharing with longshot and launcher
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Author: ender1324 <ender1324@abv.bg>
Date: Wed, 3 Feb 2021 15:40:04 +0200
base: Add missing long screenshot permission
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Signed-off-by: alk3pInjection <webmaster@raspii.tech>
Change-Id: I4fd74068c6b634c7db5ae0226a85b11959a532ed
|
|
Also add delete action for partial screenshot notification
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Change-Id: I10880a731b6c91edd32f6a0084ad609e07b2564f
|
|
* meaningless since we'll introduce StitchImage
This reverts commit 7e0f34b2c43bfa2a8466dccaaf5eb613393aa347.
Change-Id: I201f34983e4b2fb77318d1b04ba49036948d1f8b
|
|
This reverts commit 5d4cb837cc3cb0be1efa06ed37fc1f55b473c904.
neobuddy89: Also remove broken "Delete" action
Change-Id: I6d02c88945df5131931e4d337fa8f07e2d1ddba8
|
|
Signed-off-by: ganeshi4u <ganeshvarmai4u@gmail.com>
Change-Id: I4432178f93601af91e2cae5e7206a1764c201aab
|
|
screenshots
The screenshot code already dismisses the old screenshot preview
immediately before taking a new one, but it fails to account for the
fact that the change will not take effect until the next frame render,
and takes a new screenshot immediately.
To fix the problem, we can invalidate the root view just in case to make
sure the screen will be re-rendered, and then take the screenshot after
the new frame has been committed.
Unfortunately, this adds ~2 frames of latency to screenshot capturing
because we have to attach the screenshot callback to the beginning of
the next frame, but I'm not aware of any way to reduce it as we can't
attach a post-frame commit callback from here.
Change-Id: I76aaeb27747c5f025e31ccf6dbcff45d2c26d484
|
|
400 ms feels too long for this, especially when the actions already take
so long to show up due to how long saving the screenshot takes.
Change-Id: Ia7a264e34ad417b734716b7f6a57f2f5147d693d
|
|
2 seconds is more than enough for most cases. Keeping the overlay around
for too long forces the user to dismiss it manually, which is a
regression compared to the old screenshot notification UI.
Change-Id: I5644a055d1285d390d77430670fd6f43862c9608
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
|
|
In my opinion, this animation serves no purpose because it doesn't
correspond to any animations in the text selection/handle flow, and is
barely noticeable in typical text selection cases. In addition, it makes
the magnifier feel slow/laggy when selecting a large block of text
quickly.
Change-Id: I5fed9fc06db4491dc2811815741830001d295030
|
|
of teal
Change-Id: I97ab75e68693c071ec50e78a9159202f83cf284b
|
|
We've disabled all-caps button text throughout the system, but this
label has been capitalized manually in strings. Make it consistent with
the rest of the system.
Change-Id: I95d2b97c3b493b4928d0965e82b3272232d5b567
|
|
The color used for this divider in dark mode contrasts too much with the
pure black background in the QS, and even in light mode, the divider
disrupts the otherwise clean and streamlined style of not having
dividers in the QS. Let's just remove the divider altogether for both
themes to clean up the QS when the media player is shown.
The code controlling the divider has been removed altogether to avoid
misleading people who read through the code, as well as to reduce unused
code bloat.
Change-Id: Ie3d9e0070c974b598a8784225375882b4b67173e
|
|
Specifying the blur radius in pixels leads to inconsistent results
across devices with different pixel densities. With a Pixel 4 XL
(1440x3040) as the reference display (3.5x scale factor), 175 px is more
or less the amount of blur we want, but it's too strong on the Pixel 5
(1080x2340).
Define the blur radius in device-independent pixels (calculated from the
reference display described above) to make the strength uniform.
Change-Id: I3295282de81389cc863d63d58370febaf16a0623
|
|
The increased radius helps create a "glass blur" effect, which looks
better than the default radius that lies in an ugly intermediate range
between "no blur" and "glass blur".
Change-Id: I24fc4f0f99468371fa3b16017e458f6151518858
|
|
for performance
When opening and closing activities in Settings, a significant amount of
CPU time is spent performing JNI calls, as reported by simpleperf:
0.39% /system/framework/arm64/boot-framework.oat art_jni_trampoline
Reflection in LayoutInflater is responsible for a significant portion
of the time spent in the JNI trampoline:
6.08% 0.08% /apex/com.android.art/javalib/arm64/boot.oat art_jni_trampoline
|
-- art_jni_trampoline
|
|--12.38%-- java.lang.reflect.Constructor.newInstance
| |--0.09%-- [hit in function]
| |
| |--88.32%-- android.view.LayoutInflater.createView
| | |
| | |--83.39%-- com.android.internal.policy.PhoneLayoutInflater.onCreateView
| | | android.view.LayoutInflater.onCreateView
| | | android.view.LayoutInflater.onCreateView
| | | android.view.LayoutInflater.createViewFromTag
| | | |
| | | |--72.73%-- android.view.LayoutInflater.rInflate
| | | | |
| | | | |--57.90%-- android.view.LayoutInflater.rInflate
| | | | | |
| | | | | |--94.90%-- android.view.LayoutInflater.inflate
| | | | | | android.view.LayoutInflater.inflate
| | | | | | |--35.86%-- [hit in function]
| | | | | | |
| | | | | | |--58.15%-- androidx.preference.PreferenceGroupAdapter.onCreateViewHolder
Empirical testing of interacting with ~113 real-world apps reveals that
many of the most frequently-inflated views are framework classes:
13486 android.widget.LinearLayout
6930 android.widget.View
6447 android.widget.FrameLayout
5613 android.widget.ViewStub
5608 androidx.constraintlayout.widget.ConstraintLayout
4722 android.widget.TextView
4431 com.google.android.material.textview.MaterialTextView
3570 eu.faircode.email.FixedTextView
3044 android.widget.ImageView
2665 android.widget.RelativeLayout
1694 android.widget.Space
979 androidx.preference.internal.PreferenceImageView
926 androidx.appcompat.view.menu.ActionMenuItemView
884 androidx.appcompat.widget.AppCompatImageView
855 slack.uikit.components.icon.SKIconView
770 android.widget.ProgressBar
743 com.fastaccess.ui.widgets.FontTextView
541 androidx.recyclerview.widget.RecyclerView
442 androidx.appcompat.widget.AppCompatTextView
404 org.mariotaku.twidere.view.MediaPreviewImageView
393 com.moez.QKSMS.common.widget.QkTextView
382 android.widget.Button
365 slack.widgets.core.textview.ClickableLinkTextView
365 slack.uikit.components.avatar.SKAvatarView
352 com.google.android.libraries.inputmethod.widgets.SoftKeyView
351 com.android.launcher3.BubbleTextView
315 slack.widgets.core.viewcontainer.SingleViewContainer
315 slack.widgets.core.textview.MaxWidthTextView
313 androidx.constraintlayout.widget.Barrier
302 slack.app.ui.widgets.ReactionsLayout
302 slack.app.ui.messages.widgets.MessageLayout
302 slack.app.ui.messages.widgets.MessageHeader
290 com.android.launcher3.views.DoubleShadowBubbleTextView
285 com.android.internal.widget.CachingIconView
265 android.widget.ImageButton
262 androidx.constraintlayout.widget.Guideline
249 org.thoughtcrime.securesms.components.emoji.EmojiTextView
234 com.google.android.libraries.inputmethod.widgets.AutoSizeTextView
232 com.android.internal.widget.RemeasuringLinearLayout
228 android.view.ViewStub
227 android.app.ViewStub
226 android.webkit.ViewStub
221 im.vector.app.core.ui.views.ShieldImageView
219 androidx.constraintlayout.widget.Group
214 androidx.coordinatorlayout.widget.CoordinatorLayout
204 androidx.appcompat.widget.ContentFrameLayout
All framework classes seen:
13486 android.widget.LinearLayout
6930 android.widget.View
6447 android.widget.FrameLayout
5613 android.widget.ViewStub
4722 android.widget.TextView
3044 android.widget.ImageView
2665 android.widget.RelativeLayout
1694 android.widget.Space
770 android.widget.ProgressBar
382 android.widget.Button
265 android.widget.ImageButton
228 android.view.ViewStub
227 android.app.ViewStub
226 android.webkit.ViewStub
145 android.widget.Switch
117 android.widget.DateTimeView
86 android.widget.Toolbar
68 android.widget.HorizontalScrollView
67 android.widget.ScrollView
65 android.widget.NotificationHeaderView
65 android.webkit.NotificationHeaderView
65 android.view.NotificationHeaderView
65 android.app.NotificationHeaderView
63 android.webkit.View
63 android.view.View
62 android.app.View
58 android.widget.ListView
50 android.widget.QuickContactBadge
40 android.widget.SeekBar
38 android.widget.CheckBox
16 android.widget.GridLayout
15 android.widget.TableRow
15 android.widget.RadioGroup
15 android.widget.Chronometer
13 android.widget.ViewFlipper
9 android.widget.Spinner
8 android.widget.ViewSwitcher
8 android.widget.TextSwitcher
8 android.widget.SurfaceView
8 android.widget.CheckedTextView
8 android.preference.PreferenceFrameLayout
7 android.widget.TwoLineListItem
5 android.widget.TableLayout
5 android.widget.EditText
3 android.widget.TabWidget
3 android.widget.TabHost
2 android.widget.ZoomButton
2 android.widget.TextureView
2 android.widget.ExpandableListView
2 android.webkit.TextureView
2 android.view.TextureView
2 android.app.TextureView
1 android.widget.WebView
1 android.widget.ViewAnimator
1 android.widget.TextClock
1 android.widget.AutoCompleteTextView
1 android.webkit.WebView
1 android.webkit.SurfaceView
1 android.view.SurfaceView
1 android.app.SurfaceView
Unfortunately, replacing reflection with MethodHandle constructors is
counter-productive in terms of performance:
Constructor direct: create=5 invoke=42
Constructor reflection: create=310 invoke=433
Constructor MethodHandle: create=3283 invoke=3489
Constructor MethodHandle-exact: create=3273 invoke=3453
To reduce the performance impact of slow reflection, we can leverage the
fact that the most frequently-inflated classes are from the framework,
and hard-code direct constructor references for them in a switch-case
block. Reflection will automatically be used as a fallback for custom
app views.
Test: simpleperf record -a; verify that Constructor.newInstance ->
LayoutInflater no longer appears at the top under
art_jni_trampoline
Change-Id: I8fcc0e05813ff9ecf1eddca3cc6920e747adf4fc
|
|
performance
When opening and closing activities in Settings, a significant amount of
CPU time is spent looking up ArrayMap entries, as reported by simpleperf:
0.12% /system/framework/arm64/boot-framework.oat
android.util.ArrayMap.binarySearchHashes
PackageManagerService is responsible for a significant portion of the time
spent in ArrayMap lookups:
0.08% 0.08% /system/framework/arm64/boot-framework.oat
android.util.ArrayMap.binarySearchHashes
|
-- android.util.ArrayMap.binarySearchHashes
|
--50.00%-- android.util.ArrayMap.indexOf
|
|--36.71%-- android.util.ArrayMap.get
| |--0.87%-- [hit in function]
| |
| |--5.42%-- android.app.SystemServiceRegistry.getSystemService
| | android.app.ContextImpl.getSystemService
| | android.view.ContextThemeWrapper.getSystemService
| | android.app.Activity.getSystemService
| | |
| | |--52.18%-- TemporaryFile-kEdnnv[+9b97baa8]
| | | TemporaryFile-FwF2he[+9b96d048]
| | | art_quick_invoke_stub
| | | art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)
| | | art::interpreter::ArtInterpreterToCompiledCodeBridge(art::Thread*, art::ArtMethod*, art::ShadowFrame*, unsigned short, art::JValue*)
| | | bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)
| | | MterpInvokeVirtual
| | | mterp_op_invoke_virtual
| | | libcrypto.so[+3fac6]
| | | MterpInvokeDirect
| | | mterp_op_invoke_direct
| | | libcrypto.so[+3faa8]
| | | MterpInvokeVirtual
| | | mterp_op_invoke_virtual
| | | libcrypto.so[+3730c]
| | | art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool, bool) (.llvm.13341777805210357670)
| | | artQuickToInterpreterBridge
| | | art_quick_to_interpreter_bridge
| | | java.util.concurrent.Executors$RunnableAdapter.call
| | | java.util.concurrent.FutureTask.run
| | | java.util.concurrent.ThreadPoolExecutor.runWorker
| | | java.util.concurrent.ThreadPoolExecutor$Worker.run
| | | java.lang.Thread.run
| | | art_quick_invoke_stub
| | | art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)
| | | art::JValue art::InvokeVirtualOrInterfaceWithJValues<art::ArtMethod*>(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, art::ArtMethod*, jvalue const*)
| | | art::Thread::CreateCallback(void*)
| | | __pthread_start(void*)
| | | __start_thread
| | |
| | --47.82%-- android.view.ContextThemeWrapper.getSystemService
| | android.view.ContextThemeWrapper.getSystemService
| | android.content.Context.getSystemService
| | android.view.View.onVisibilityAggregated
| | android.view.View.dispatchAttachedToWindow
| | android.view.ViewGroup.dispatchAttachedToWindow
| | android.view.ViewGroup.dispatchAttachedToWindow
| | android.view.ViewGroup.dispatchAttachedToWindow
| | android.view.ViewGroup.dispatchAttachedToWindow
| | android.view.ViewGroup.dispatchAttachedToWindow
| | android.view.ViewGroup.dispatchAttachedToWindow
| | android.view.ViewGroup.dispatchAttachedToWindow
| | android.view.ViewRootImpl.performTraversals
| | android.view.ViewRootImpl.doTraversal
| | android.content.ContextWrapper.getAssets [DEDUPED]
| | android.view.Choreographer.doCallbacks
| | android.view.Choreographer.doFrame
| | android.view.Choreographer$FrameDisplayEventReceiver.run
| | android.os.Handler.dispatchMessage
| | android.os.Looper.loop
| | android.app.ActivityThread.main
| | art_quick_invoke_static_stub
| | art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)
| | art::InvokeMethod(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jobject*, _jobject*, unsigned long)
| | art::Method_invoke(_JNIEnv*, _jobject*, _jobject*, _jobjectArray*)
| | art_jni_trampoline
| | com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run
| | com.android.internal.os.ZygoteInit.main
| | art_quick_invoke_static_stub
| | art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)
| | art::JValue art::InvokeWithVarArgs<art::ArtMethod*>(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, art::ArtMethod*, std::__va_list)
| | art::JValue art::InvokeWithVarArgs<_jmethodID*>(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jmethodID*, std::__va_list)
| | art::JNI<true>::CallStaticVoidMethodV(_JNIEnv*, _jclass*, _jmethodID*, std::__va_list)
| | _JNIEnv::CallStaticVoidMethod(_jclass*, _jmethodID*, ...)
| | android::AndroidRuntime::start(char const*, android::Vector<android::String8> const&, bool)
| | main
| | __libc_init
| |
Empirical testing reveals that SYSTEM_SERVICE_FETCHERS contains 134
entries, at which HashMap is 54% faster than ArrayMap for lookups and
74% faster [1] for insertions. The increased memory usage should be
a worthwhile trade-off at this size, so we can safely convert the map
to a HashMap in order to improve performance in this hotpath.
Because SYSTEM_SERVICE_NAMES, SYSTEM_SERVICE_FETCHERS, and
SYSTEM_SERVICE_CLASS_NAMES have the same names and similar uses, all of
them have been converted to HashMaps for consistency and performance.
[1] https://docs.google.com/spreadsheets/d/136UJS2yVlZyPx30KDNgj4AWldkp9xbzIcWkLFj9RGgk/edit
Test: simpleperf record -a; verify that SystemServiceRegistry no longer
appears under ArrayMap.binarySearchHashes
Change-Id: I2a5b23793a4fc8aa720eead3ecc7ca4589cb67da
|
|
performance
When opening and closing activities in Settings, a significant amount of
CPU time is spent looking up ArrayMap entries, as reported by simpleperf:
0.12% /system/framework/arm64/boot-framework.oat
android.util.ArrayMap.binarySearchHashes
PackageManagerService is responsible for a significant portion of the time
spent in ArrayMap lookups:
0.08% 0.08% /system/framework/arm64/boot-framework.oat
android.util.ArrayMap.binarySearchHashes
|
-- android.util.ArrayMap.binarySearchHashes
|
--50.00%-- android.util.ArrayMap.indexOf
|
|--36.71%-- android.util.ArrayMap.get
| |--0.87%-- [hit in function]
| |
| |--8.21%-- com.android.server.pm.PackageManagerService$PackageManagerInternalImpl.getPackage
| | |
| | |--74.06%-- com.android.server.pm.ComponentResolver$ActivityIntentResolver.newResult
| | |
| | --25.94%-- com.android.server.usage.AppStandbyController$Injector.getValidCrossProfileTargets
| |
| |--7.13%-- com.android.server.pm.PackageManagerService.resolveInternalPackageNameInternalLocked
| | |
| | |--56.77%-- com.android.server.pm.PackageManagerService.getPackageInfoInternal
| | | |
| | | |--54.96%-- com.android.server.power.PowerManagerService.acquireWakeLockInternal
| | | |
| | | --45.04%-- com.android.server.power.PowerManagerService.userActivityInternal
| | |
| | |--22.44%-- com.android.server.pm.PackageManagerService$PackageManagerInternalImpl.getPackage
| | |
| | --20.79%-- com.android.server.pm.PackageManagerService.getPackageSettingInternal
| |
| |--7.08%-- com.android.server.pm.PackageManagerService.getPackageSettingInternal
| | |
| | |--40.25%-- com.android.server.pm.PackageManagerService.getPackageUidInternal
| | |
| | |--33.33%-- com.android.server.pm.PackageManagerService.getPackageSetting
| | | |
| | | |--63.07%-- com.android.server.pm.PackageManagerService$PackageManagerInternalImpl.filterAppAccess
| | | |
| | | --36.93%-- com.android.server.pm.permission.PermissionManagerService.checkPermissionInternal
| | |
| | --26.42%-- com.android.server.pm.PackageManagerService.applyPostResolutionFilter
Empirical testing reveals that mPackages contains 359 entries on my
device, at which HashMap is 64% faster than ArrayMap for lookups and
85% faster [1] for insertions. The increased memory usage should be
a worthwhile trade-off at this size, so we can safely convert the map
to a HashMap in order to improve performance in this hotpath.
Because profiling sample hits can also be seen in Settings.mPackages,
which is the same size as PackageManagerService.mPackages, both have
been converted to HashMaps.
[1] https://docs.google.com/spreadsheets/d/136UJS2yVlZyPx30KDNgj4AWldkp9xbzIcWkLFj9RGgk/edit
Test: simpleperf record -a; verify that PackageManagerService no longer
appears under ArrayMap.binarySearchHashes
Change-Id: Ie888a6d88390529fde7cb4ba4758058c74b1ff01
|
|
performance
When opening and closing activities in Settings, a significant amount of
CPU time is spent looking up ArrayMap entries, as reported by simpleperf:
0.12% /system/framework/arm64/boot-framework.oat
android.util.ArrayMap.binarySearchHashes
InsetsStateController is responsible for a significant portion of the time
spent in ArrayMap lookups:
0.08% 0.08% /system/framework/arm64/boot-framework.oat
android.util.ArrayMap.binarySearchHashes
|
-- android.util.ArrayMap.binarySearchHashes
|
--50.00%-- android.util.ArrayMap.indexOf
|
|--36.71%-- android.util.ArrayMap.get
| |--0.87%-- [hit in function]
| |
| |--6.67%-- com.android.server.wm.InsetsStateController.peekSourceProvider
| | |
| | |--68.77%-- com.android.server.wm.DisplayPolicy.beginLayoutLw
| | | com.android.server.wm.DisplayContent.performLayoutNoTrace
| | | com.android.server.wm.DisplayContent.performLayout
| | | com.android.server.wm.DisplayContent.applySurfaceChangesTransaction
| | | com.android.server.wm.RootWindowContainer.applySurfaceChangesTransaction
| | | com.android.server.wm.RootWindowContainer.performSurfacePlacementNoTrace
| | | com.android.server.wm.RootWindowContainer.performSurfacePlacement
| | | com.android.server.wm.WindowSurfacePlacer.performSurfacePlacementLoop
| | | com.android.server.wm.WindowSurfacePlacer.performSurfacePlacement
| | | com.android.server.wm.WindowManagerService.relayoutWindow
| | | com.android.server.wm.Session.relayout
| | | android.view.IWindowSession$Stub.onTransact
| | | com.android.server.wm.Session.onTransact
| | | android.os.Binder.execTransactInternal
| | | android.os.Binder.execTransact
| | | art_quick_invoke_stub
| | | art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)
| | | art::JValue art::InvokeVirtualOrInterfaceWithVarArgs<art::ArtMethod*>(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, art::ArtMethod*, std::__va_list)
| | | art::JValue art::InvokeVirtualOrInterfaceWithVarArgs<_jmethodID*>(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jmethodID*, std::__va_list)
| | | art::JNI<false>::CallBooleanMethodV(_JNIEnv*, _jobject*, _jmethodID*, std::__va_list)
| | | _JNIEnv::CallBooleanMethod(_jobject*, _jmethodID*, ...)
| | | JavaBBinder::onTransact(unsigned int, android::Parcel const&, android::Parcel*, unsigned int)
| | | android::BBinder::transact(unsigned int, android::Parcel const&, android::Parcel*, unsigned int)
| | | android::IPCThreadState::executeCommand(int)
| | | android::IPCThreadState::getAndExecuteCommand()
| | | android::IPCThreadState::joinThreadPool(bool)
| | | android::PoolThread::threadLoop()
| | | android::Thread::_threadLoop(void*)
| | | android::AndroidRuntime::javaThreadShell(void*)
| | | thread_data_t::trampoline(thread_data_t const*)
| | | __pthread_start(void*)
| | | __start_thread
| | |
| | --31.23%-- com.android.server.wm.DisplayPolicy.updateHideNavInputEventReceiver
| | com.android.server.wm.InsetsPolicy.updateBarControlTarget
| | com.android.server.wm.DisplayPolicy.updateSystemUiVisibilityLw
| | com.android.server.wm.DisplayPolicy.finishPostLayoutPolicyLw
| | com.android.server.wm.DisplayContent.applySurfaceChangesTransaction
| | com.android.server.wm.RootWindowContainer.applySurfaceChangesTransaction
| | com.android.server.wm.RootWindowContainer.performSurfacePlacementNoTrace
| | com.android.server.wm.RootWindowContainer.performSurfacePlacement
| | com.android.server.wm.WindowSurfacePlacer.performSurfacePlacementLoop
| | com.android.server.wm.WindowSurfacePlacer.performSurfacePlacement
| | com.android.server.wm.WindowManagerService.postWindowRemoveCleanupLocked
| | com.android.server.wm.WindowState.removeImmediately
| | com.android.server.wm.WindowState.removeIfPossible
| | com.android.server.wm.WindowState.removeIfPossible
| | com.android.server.wm.WindowManagerService.removeWindow
| | com.android.server.wm.Session.remove
| | android.view.IWindowSession$Stub.onTransact
| | com.android.server.wm.Session.onTransact
| | android.os.Binder.execTransactInternal
| | android.os.Binder.execTransact
| | art_quick_invoke_stub
| | art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)
| | art::JValue art::InvokeVirtualOrInterfaceWithVarArgs<art::ArtMethod*>(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, art::ArtMethod*, std::__va_list)
| | art::JValue art::InvokeVirtualOrInterfaceWithVarArgs<_jmethodID*>(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jmethodID*, std::__va_list)
| | art::JNI<false>::CallBooleanMethodV(_JNIEnv*, _jobject*, _jmethodID*, std::__va_list)
| | _JNIEnv::CallBooleanMethod(_jobject*, _jmethodID*, ...)
| | JavaBBinder::onTransact(unsigned int, android::Parcel const&, android::Parcel*, unsigned int)
| | android::BBinder::transact(unsigned int, android::Parcel const&, android::Parcel*, unsigned int)
| | android::IPCThreadState::executeCommand(int)
| | android::IPCThreadState::getAndExecuteCommand()
| | android::IPCThreadState::joinThreadPool(bool)
| | android::PoolThread::threadLoop()
| | android::Thread::_threadLoop(void*)
| | android::AndroidRuntime::javaThreadShell(void*)
| | thread_data_t::trampoline(thread_data_t const*)
| | __pthread_start(void*)
| | __start_thread
| |
Empirical testing reveals that mProviders usually contains 9 entries,
at which HashMap is 34% faster than ArrayMap for lookups and 57% faster
[1] for insertions. The increased memory usage should be negligible at
this size, so we can safely convert the map to a HashMap in order to
improve performance in this hotpath.
[1] https://docs.google.com/spreadsheets/d/136UJS2yVlZyPx30KDNgj4AWldkp9xbzIcWkLFj9RGgk/edit
Test: simpleperf record -a; verify that InsetsStateController no longer
appears under ArrayMap.binarySearchHashes
Change-Id: Ic08d4c3e56cf10b322eabc115de441c6c5f4a898
|
|
When opening and closing activities in Settings, a significant amount of
CPU time is spent looking up ArrayMap entries, as reported by simpleperf:
0.12% /system/framework/arm64/boot-framework.oat android.util.ArrayMap.binarySearchHashes
LocalServices is responsible for a significant portion of the time
spent in ArrayMap lookups:
0.08% 0.08% /system/framework/arm64/boot-framework.oat android.util.ArrayMap.binarySearchHashes
|
-- android.util.ArrayMap.binarySearchHashes
|
--50.00%-- android.util.ArrayMap.indexOf
|
|--36.71%-- android.util.ArrayMap.get
| |--0.87%-- [hit in function]
| |
| |--6.12%-- com.android.server.LocalServices.getService
| | |
| | |--42.41%-- com.android.server.inputmethod.InputMethodManagerInternal.get [DEDUPED]
| | | com.android.server.wm.-$$Lambda$DisplayContent$-xtu90EUfC_AM8Qe5g8vDDI07_E.run
| | | android.os.Handler.dispatchMessage
| | | android.os.Looper.loop
| | | android.os.HandlerThread.run
| | | com.android.server.ServiceThread.run
| | | art_quick_invoke_stub
| | | art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)
| | | art::JValue art::InvokeVirtualOrInterfaceWithJValues<art::ArtMethod*>(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, art::ArtMethod*, jvalue const*)
| | | art::Thread::CreateCallback(void*)
| | | __pthread_start(void*)
| | | __start_thread
| | |
| | |--36.66%-- com.android.server.notification.NotificationManagerService.enqueueNotificationInternal
| | | com.android.server.notification.NotificationManagerService.enqueueNotificationInternal
| | | com.android.server.notification.NotificationManagerService$10.enqueueNotificationWithTag
| | | android.app.INotificationManager$Stub.onTransact
| | | android.os.Binder.execTransactInternal
| | | android.os.Binder.execTransact
| | | art_quick_invoke_stub
| | | art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)
| | | art::JValue art::InvokeVirtualOrInterfaceWithVarArgs<art::ArtMethod*>(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, art::ArtMethod*, std::__va_list)
| | | art::JValue art::InvokeVirtualOrInterfaceWithVarArgs<_jmethodID*>(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jmethodID*, std::__va_list)
| | | art::JNI<false>::CallBooleanMethodV(_JNIEnv*, _jobject*, _jmethodID*, std::__va_list)
| | | _JNIEnv::CallBooleanMethod(_jobject*, _jmethodID*, ...)
| | | JavaBBinder::onTransact(unsigned int, android::Parcel const&, android::Parcel*, unsigned int)
| | | android::BBinder::transact(unsigned int, android::Parcel const&, android::Parcel*, unsigned int)
| | | android::IPCThreadState::executeCommand(int)
| | | android::IPCThreadState::getAndExecuteCommand()
| | | android::IPCThreadState::joinThreadPool(bool)
| | | android::PoolThread::threadLoop()
| | | android::Thread::_threadLoop(void*)
| | | android::AndroidRuntime::javaThreadShell(void*)
| | | thread_data_t::trampoline(thread_data_t const*)
| | | __pthread_start(void*)
| | | __start_thread
| | |
| | --20.93%-- com.android.server.oemlock.OemLockService.setPersistentDataBlockOemUnlockAllowedBit
| | com.android.server.oemlock.OemLockService$2.isOemUnlockAllowed
| | android.service.oemlock.IOemLockService$Stub.onTransact
| | android.os.Binder.execTransactInternal
| | android.os.Binder.execTransact
| | art_quick_invoke_stub
| | art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)
| | art::JValue art::InvokeVirtualOrInterfaceWithVarArgs<art::ArtMethod*>(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, art::ArtMethod*, std::__va_list)
| | art::JValue art::InvokeVirtualOrInterfaceWithVarArgs<_jmethodID*>(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jmethodID*, std::__va_list)
| | art::JNI<false>::CallBooleanMethodV(_JNIEnv*, _jobject*, _jmethodID*, std::__va_list)
| | _JNIEnv::CallBooleanMethod(_jobject*, _jmethodID*, ...)
| | JavaBBinder::onTransact(unsigned int, android::Parcel const&, android::Parcel*, unsigned int)
| | android::BBinder::transact(unsigned int, android::Parcel const&, android::Parcel*, unsigned int)
| | android::IPCThreadState::executeCommand(int)
| | android::IPCThreadState::getAndExecuteCommand()
| | android::IPCThreadState::joinThreadPool(bool)
| | android::PoolThread::threadLoop()
| | android::Thread::_threadLoop(void*)
| | android::AndroidRuntime::javaThreadShell(void*)
| | thread_data_t::trampoline(thread_data_t const*)
| | __pthread_start(void*)
| | __start_thread
Empirical testing reveals that sLocalServiceObjects usually contains
68 entries, at which HashMap is 47% faster than ArrayMap for lookups
and 68% faster [1] for insertions. The increased memory usage should be
negligible at this size, so we can safely convert the map to a HashMap
in order to improve performance in this hotpath.
[1] https://docs.google.com/spreadsheets/d/136UJS2yVlZyPx30KDNgj4AWldkp9xbzIcWkLFj9RGgk/edit
Test: simpleperf record -a; verify that LocalServices no longer
appears under ArrayMap.binarySearchHashes
Change-Id: Ifd1f8b7940eba7723f93a73456470a84d34656ae
|
|
performance
When opening and closing activities in Settings, a significant amount of
CPU time is spent looking up ArrayMap entries, as reported by simpleperf:
0.12% /system/framework/arm64/boot-framework.oat android.util.ArrayMap.binarySearchHashes
ThemedResourceCache is responsible for a significant portion of the time
spent in ArrayMap lookups:
0.08% 0.08% /system/framework/arm64/boot-framework.oat android.util.ArrayMap.binarySearchHashes
|
-- android.util.ArrayMap.binarySearchHashes
|
--50.00%-- android.util.ArrayMap.indexOf
|
|--36.71%-- android.util.ArrayMap.get
| |--0.87%-- [hit in function]
| |
| |--9.64%-- android.content.res.ThemedResourceCache.getThemedLocked
| | android.content.res.ThemedResourceCache.get
| | |
| | |--77.92%-- android.content.res.DrawableCache.getInstance
| | | android.content.res.ResourcesImpl.loadDrawable
| | | android.content.res.Resources.loadDrawable
| | | android.content.res.TypedArray.getDrawableForDensity
| | | android.content.res.Resources.getColor [DEDUPED]
| | | |
| | | |--62.94%-- android.view.View.<init>
| | | | |
| | | | |--64.58%-- android.view.ViewGroup.<init>
| | | | | android.widget.LinearLayout.<init>
| | | | | android.widget.LinearLayout.<init>
| | | | | art_quick_invoke_stub
| | | | | art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)
| | | | | art::InvokeConstructor(art::ScopedObjectAccessAlreadyRunnable const&, art::ArtMethod*, art::ObjPtr<art::mirror::Object>, _jobject*)
| | | | | art::Constructor_newInstance0(_JNIEnv*, _jobject*, _jobjectArray*)
| | | | | art_jni_trampoline
| | | | | java.lang.reflect.Constructor.newInstance
| | | | | android.view.LayoutInflater.createView
| | | | | com.android.internal.policy.PhoneLayoutInflater.onCreateView
| | | | | android.view.LayoutInflater.onCreateView
| | | | | android.view.LayoutInflater.onCreateView
| | | | | android.view.LayoutInflater.createViewFromTag
| | | | | android.view.LayoutInflater.inflate
| | | | | android.view.LayoutInflater.inflate
| | | | |
| | | | --35.42%-- android.widget.TextView.<init>
| | | | android.widget.Button.<init>
| | | | art_quick_invoke_stub
| | | | art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)
| | | | art::InvokeConstructor(art::ScopedObjectAccessAlreadyRunnable const&, art::ArtMethod*, art::ObjPtr<art::mirror::Object>, _jobject*)
| | | | art::Constructor_newInstance0(_JNIEnv*, _jobject*, _jobjectArray*)
| | | | art_jni_trampoline
| | | | java.lang.reflect.Constructor.newInstance
| | | | android.view.LayoutInflater.createView
| | | | com.android.internal.policy.PhoneLayoutInflater.onCreateView
| | | | android.view.LayoutInflater.onCreateView
| | | | android.view.LayoutInflater.onCreateView
| | | | android.view.LayoutInflater.createViewFromTag
| | | | android.view.LayoutInflater.rInflate
| | | | android.view.LayoutInflater.rInflate
| | | | android.view.LayoutInflater.rInflate
| | | | android.view.LayoutInflater.inflate
| | | | android.view.LayoutInflater.inflate
| | | | android.view.LayoutInflater.inflate
| | | |
| | | --37.06%-- com.android.internal.widget.ToolbarWidgetWrapper.<init>
| | |
| | --22.08%-- android.content.res.ConfigurationBoundResourceCache.get
| | android.content.res.ConfigurationBoundResourceCache.getInstance
| | android.content.res.ResourcesImpl.loadComplexColorFromName
| | android.content.res.ResourcesImpl.loadColorStateList
| | android.content.res.Resources.loadColorStateList
| | android.content.res.TypedArray.getColorStateList
| | android.widget.TextView.readTextAppearance
| | android.widget.TextView.setTextAppearance
| | android.widget.TextView.setTextAppearance
| | android.widget.Toolbar.setTitle
| | com.android.wifi.x.com.android.internal.util.StateMachine$SmHandler.handleMessage
| | android.view.SurfaceControl.copyFrom
Empirical testing reveals that mThemedEntries usually contains around 14
entries, at which HashMap is 35% faster than ArrayMap for lookups and
54% faster [1] for insertions. The increased memory usage should be
negligible at this size, so we can safely convert the map to a HashMap
in order to improve performance in this hotpath.
[1] https://docs.google.com/spreadsheets/d/136UJS2yVlZyPx30KDNgj4AWldkp9xbzIcWkLFj9RGgk/edit
Test: simpleperf record -a; verify that ThemedResourceCache no longer
appears under ArrayMap.binarySearchHashes
Change-Id: I39e1c4b03fe0e60f933f02e253d2d3c4a483146f
|
|
When opening and closing activities in Settings, a significant amount of
CPU time is spent checking whether ATrace tags are enabled, as measured
by simpleperf:
0.12% /system/lib64/libcutils.so atrace_get_enabled_tag
android.os.Trace is responsible for a significant portion of the time
spent in the checks:
0.10% 0.07% /system/lib64/libcutils.so atrace_get_enabled_tags
|
-- atrace_get_enabled_tags
|
|
|--1.62%-- android.os.Trace.traceEnd
| |--36.90%-- [hit in function]
| |
| |--29.76%-- android.view.Choreographer.doCallbacks
| | android.view.Choreographer.doFrame
| | android.view.Choreographer$FrameDisplayEventReceiver.run
| | android.os.Handler.dispatchMessage
| | android.os.Looper.loop
| | android.os.HandlerThread.run
| | com.android.server.ServiceThread.run
| | art_quick_invoke_stub
| | art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)
| | art::JValue art::InvokeVirtualOrInterfaceWithJValues<art::ArtMethod*>(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, art::ArtMethod*, jvalue const*)
| | art::Thread::CreateCallback(void*)
| | __pthread_start(void*)
| | __start_thread
| |
| |--19.00%-- com.android.server.BatteryService$BatteryPropertiesRegistrar.getProperty
| | android.os.IBatteryPropertiesRegistrar$Stub.onTransact
| | android.os.Binder.execTransactInternal
| | android.os.Binder.execTransact
| | art_quick_invoke_stub
| | art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)
| | art::JValue art::InvokeVirtualOrInterfaceWithVarArgs<art::ArtMethod*>(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, art::ArtMethod*, std::__va_list)
| | art::JValue art::InvokeVirtualOrInterfaceWithVarArgs<_jmethodID*>(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jmethodID*, std::__va_list)
| | art::JNI<false>::CallBooleanMethodV(_JNIEnv*, _jobject*, _jmethodID*, std::__va_list)
| | _JNIEnv::CallBooleanMethod(_jobject*, _jmethodID*, ...)
| | JavaBBinder::onTransact(unsigned int, android::Parcel const&, android::Parcel*, unsigned int)
| | android::BBinder::transact(unsigned int, android::Parcel const&, android::Parcel*, unsigned int)
| | android::IPCThreadState::executeCommand(int)
| | android::IPCThreadState::getAndExecuteCommand()
| | android::IPCThreadState::joinThreadPool(bool)
| | android::PoolThread::threadLoop()
| | android::Thread::_threadLoop(void*)
| | android::AndroidRuntime::javaThreadShell(void*)
| | thread_data_t::trampoline(thread_data_t const*)
| | __pthread_start(void*)
| | __start_thread
| |
| --14.33%-- android.view.ViewRootImpl.performDraw
| android.view.ViewRootImpl.performTraversals
| android.view.ViewRootImpl.doTraversal
| android.content.ContextWrapper.getAssets [DEDUPED]
| android.view.Choreographer.doCallbacks
| android.view.Choreographer.doFrame
| android.view.Choreographer$FrameDisplayEventReceiver.run
| android.os.Handler.dispatchMessage
| android.os.Looper.loop
| android.app.ActivityThread.main
| art_quick_invoke_static_stub
| art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)
| art::InvokeMethod(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jobject*, _jobject*, unsigned long)
| art::Method_invoke(_JNIEnv*, _jobject*, _jobject*, _jobjectArray*)
| art_jni_trampoline
| com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run
| com.android.internal.os.ZygoteInit.main
| art_quick_invoke_static_stub
| art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)
| art::JValue art::InvokeWithVarArgs<art::ArtMethod*>(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, art::ArtMethod*, std::__va_list)
| art::JValue art::InvokeWithVarArgs<_jmethodID*>(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jmethodID*, std::__va_list)
| art::JNI<true>::CallStaticVoidMethodV(_JNIEnv*, _jclass*, _jmethodID*, std::__va_list)
| _JNIEnv::CallStaticVoidMethod(_jclass*, _jmethodID*, ...)
| android::AndroidRuntime::start(char const*, android::Vector<android::String8> const&, bool)
| main
| __libc_init
We're unlikely to trace the system and framework in production systems,
so disable debug tracing in non-debuggable builds. The ro.debuggable
check is performed from the Java side for simplicity.
Test: simpleperf record -a; verify that android.os.Trace no longer
appears under atrace_get_enabled_tags
Change-Id: I9b63d386c041ffd9d7ff34ecd0ec1eb95dc03b4b
|
|
When opening and closing activities in Settings, a significant amount of
CPU time is spent in ART interface method call trampolines, as reported
by simpleperf:
0.32% /apex/com.android.art/lib64/libart.so art_quick_imt_conflict_trampoline
PackageInfoWithoutStateUtils is responsible for a substantial portion of
the time:
0.34% 0.24% /apex/com.android.art/lib64/libart.so art_quick_imt_conflict_trampoline
|
-- art_quick_imt_conflict_trampoline
|
|--5.48%-- android.content.pm.parsing.PackageInfoWithoutStateUtils.appInfoFlags
| com.android.server.pm.parsing.pkg.PackageImpl.toAppInfoWithoutState
| android.content.pm.parsing.PackageInfoWithoutStateUtils.generateApplicationInfoUnchecked
| com.android.server.pm.parsing.PackageInfoUtils.generateApplicationInfo
| |
| |--33.53%-- com.android.server.pm.parsing.PackageInfoUtils.generateActivityInfo
| | |
| | |--76.24%-- com.android.server.pm.ComponentResolver$ActivityIntentResolver.newResult
To avoid the overhead of calling methods through interfaces,
opportunistically cast ParsingPackageRead objects to the real
implementation and access fields directly on it. This isn't pretty, but
it reduces the CPU time wasted on interface method calls.
Test: simpleperf record -a; verify that PackageInfoWithoutStateUtils.appInfoFlags
no longer appears under art_quick_imt_conflict_trampoline
Change-Id: I475ba804c61739c7537e664b09973665f001270b
|
|
activity before changing visibility"
This reverts commit 6dad90e5883db82c345a3ab592b26f0fd69fe28d.
When opening and closing activities in Settings, a significant amount of
CPU time is spent rendering and compressing JPEG screenshots, as
reported by simpleperf:
0.46% /system/lib64/libjpeg.so encode_mcu_gather
0.37% /system/lib64/libhwui.so neon::S32_alpha_D32_filter_DX(SkBitmapProcState const&, unsigned int const*, int, unsigned int*)
0.29% /system/lib64/libjpeg.so jsimd_extrgbx_ycc_convert_neon
0.27% /system/lib64/libjpeg.so jsimd_fdct_islow_neon
0.23% /system/lib64/libjpeg.so jsimd_huff_encode_one_block_neon
0.14% /system/lib64/libjpeg.so jsimd_quantize_neon
Call graph tracing reveals that TaskSnapshotPersister is responsible for
taking the screenshots:
0.16% 0.16% /system/lib64/libjpeg.so encode_mcu_gather
|
-- encode_mcu_gather
|
--50.00%-- compress_output
process_data_simple_main
jpeg_write_scanlines
SkJpegEncoder::onEncodeRows(int)
SkJpegEncoder::Encode(SkWStream*, SkPixmap const&, SkJpegEncoder::Options const&)
SkEncodeImage(SkWStream*, SkPixmap const&, SkEncodedImageFormat, int)
android::Bitmap::compress(SkBitmap const&, android::Bitmap::JavaCompressFormat, int, SkWStream*)
android::Bitmap::compress(android::Bitmap::JavaCompressFormat, int, SkWStream*)
Bitmap_compress(_JNIEnv*, _jobject*, long, int, int, _jobject*, _jbyteArray*)
art_jni_trampoline
android.graphics.Bitmap.compress
com.android.server.wm.TaskSnapshotPersister$StoreWriteQueueItem.writeBuffer
com.android.server.wm.TaskSnapshotPersister$StoreWriteQueueItem.write
com.android.server.wm.TaskSnapshotPersister$1.run
art_quick_invoke_stub
art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)
art::JValue art::InvokeVirtualOrInterfaceWithJValues<art::ArtMethod*>(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, art::ArtMethod*, jvalue const*)
art::Thread::CreateCallback(void*)
__pthread_start(void*)
__start_thread
Manual code tracing leads to ActivityRecord as the culprit, as it takes
a screenshot every time an Activity is finished. This doesn't appear to
be critical, so revert the commit that added it in order to reduce
excess CPU usage.
Test: simpleperf record -a; verify that libjpeg-turbo no longer appears
in top sample hits
Change-Id: Ib161679f1f3b83787f90b8ef7dcf46d246bb7c57
|
|
In order to enforce SafetyNet security, Google Play Services is now
using hardware attestation for ctsProfile validation in all cases, even
when basic attestation is selected. The SafetyNet API response from GMS
will report that basic attestation was used, but under the hood,
hardware attestation is always used regardless of the reported state.
This results in SafetyNet failing to pass due to TrustZone reporting an
unlocked bootloader (and a partially invalidated root of trust) in the
key attestation result.
We can still take advantage of the fact that this usage of hardware
attestation is opportunistic - that is, it falls back to basic
attestation if key attestation fails to run - and prevent GMS from using
key attestation at the framework level. This causes it to gracefully
fall back to basic attestation and pass SafetyNet with an unlocked
bootloader.
Key attestation is still available for other apps, as there are valid
uses for it that do not involve SafetyNet.
The "not implemented" error code from keymaster is used to simulate the
most realistic failure condition to evade detection, i.e. an old device
that lacks support for key attestation.
Change-Id: I7282ab22b933434bb11037743d46b8a20dad063a
|
|
There's a performance issue during continually scroll listview when listview in Fling state .
Consider such scene as blew:
1.Listview holds a lots of data
2.mTouchMode in TOUCH_MODE_FLING state.
3.Touch Event delivery down event to listview , mTouchMode change to TOUCH_MODE_SCROLL , post checkFlyWheel(40ms timeout). move event make checkFlywheel.endFling() delay to execute , before endFling() satisfied to execute up event occured, flingrunnable.start() will post a extra FlingRunnable in onTouchUp().
Finally Choreographer.CallbackQueue will get more and more FlingRunnable animation callback when keep repeating above steps#3, Choreographer#doFrame#animation will execute FlingRunnbale N times per frame , it will greater than vsync period cause jank (N means repeat steps#3 times).
Solution:
Remove unnecessary FlingRunnable before add FlingRunnable.
Change-Id: I2cbab9171ffbaad87a8908eef09f813cf89ad85a
|
|
Remove malloc/free of android::ResTable_entry for inline overlay
values.
Add `target_entry_inline` to the idmap format to encode inline overlay
values separate from direct mapping of target resource to overlay
resource. This reduces the number of bytes needed to represent a direct
mapping of target resource to overlay resource from 9 bytes to 8 bytes
per entry.
Fixed all idmap alignment issues that required the framework to use
"#pragma pack(push, 1)" when loading idmaps.
Bug: 170341022
Test: idmap2_tests and libandroidfw_tests
Change-Id: Iab4d3902508f02773464724913e0ee966e3689e4
|
|
This reorders methods, omits a redundant "implements" spec, and adds
<x>ValueExact() methods, which are in OpenJDK 8, but hadn't been
implemented on Android.
Also update the boot image profile to compile BigInteger-required
methods that used to be native. Some of these must be compiled to
avoid ART test timeouts.
Bug: 136887041
Bug: 119491938
Bug: 28214673
Bug: 28251030
Bug: 2950143
Test: AOSP Boots. Ran some manual Calculator tests on Cuttlefish.
Change-Id: Idd72ec6a6fd54ed4ad96a82b26840b41a3882678
|
|
Bug: 192020504
Test: Check logcat with and without the flag.
Change-Id: Ia46a011125a6e245bbd9065d708d1f905d56e3af
|
|
The bug proposes to 'move' the /proc/self/fd/ readlink/stat/etc checks
performed by the FileDescriptorAllowlist from before-fork to an earlier
stage.
The original aim was to allow the app zygote Preload hook to open
ashmem/memfd read-only regions to save more RAM (around 5MiB on aarch64)
via sharing more across processes. Potentially other files/sockets can
be opened - the app zygote takes responsibility of managing file
descriptor access controls across its own processes. App Zygote Preload
does not run 3rd party code.
Unfortunately a straightforward move of the checks to
just-before-preload has disadvantages:
* opens more codepaths for potential accidental misuse (the zygote
accepts commands between preload and fork, there are valid usecases
for extending these commands)
* this way FileDescriptorAllowlist would need to support more file
descriptor types (sockets and maybe pipes), which is not needed now
because these FDs are closed right before forking
The solution proposed here is to:
1. Determine the set of file descriptors open before preload
2. Run the preload hook
3. Determine FDs opened by the hook and allow them to remain open across
fork
4. Hypothetical new attempts to preload (if ever supported) will not
affect the allowed FDs - the preload will be able to toss its own FDs
the way it wants, but not open the new-new ones
Bug: 184808875
Test: Manual: unreleased Chrome patch: while in app zygote preload,
create ashmem region, passes it to 'untrusted_app' (=browser
process), and call mmap(2) on it.
Change-Id: Ie302eabca83a0e4f409cb131e4308b73e5f6a580
|
|
I missed a couple of CREATE_ERROR calls the first time around.
Unfortunately, type checking is loose enough to miss that.
Bug: 187992348
Test: TreeHugger
Change-Id: Ib7c227fa0e8491d8ce7cd0d82217098664e3182d
|
|
Delay execution of any zygote command that may end up forking USAPs
until we've released our own ZygoteCommandBuffer. Otherwise we fork
the child with an open ZygoteCommandBuffer, preventing it from
opening its own.
Bug: 182084594
Test: Build and boot AOSP, with USAPs enabled and disabled.
Change-Id: I2366367d2155a120092fbdcae13cbb3d7f4e1d16
|
|
* Seems to be a typo and can cause NPE.
Change-Id: I7e253c97e02767a076d9450e88ccea08c5122bb1
|
|
We were not retrying an accept() call om EINTR, resulting in occasional
zygote failures. This fixes that, and a few other calls documented
to potentially return EINTR. This is based on a quick seacrh of the
two files affected by this CL.
Bug: 193753947
Bug: 187992348
Test: Build and boot AOSP
Change-Id: Icbfb38be5110607c121545e5c200ce65d1eefbfe
|
|
Do not return to Java mode between consecutive fork operations.
This greatly reduces the Zygote overhead, since we no longer need to
stop and restart Java daemons.
By not switching back to Java mode, and being careful about what memory
we touch between forks, we also keep the Zygote heaps much more stable,
facilitating page sharing between the zygote and all its children.
Under normal operation we should no longer allocate any memory in the
zygote between forks. That applies to both the Java and C++ heap.
This makes the zygote behave much more like the mental model many
of us had assumed: It has nearly constant memory contents, which are
copy-on-right cloned at each fork. This does not apply to the initial
system server and webzygote forks, that are currently still handled
differently.
This includes
1. Add ZygoteCommandBuffer, and switch the argument parsing code to use it.
This slightly reduces allocation and enables (3).
2. Support process specialization in the child, even when the arguments
are already know, Leverages existing Usap code.
3. Add support for forking multiple child processes directly to the
ZygoteCommandBuffer data structure. This directly uses the buffer
internals, and avoids returning to Java so long as it can handle the
zygote commands it sees.
FUNCTIONALITY CHANGE:
We now limit the total size of the zygote command, rather than the
number of arguments.
Initial performance observations:
[ These are not perfect, since I'm comparing to numbers before I
started. There may have been other moving parts, but they should be
minor. ]
System-server-observed launch latency:
[Not the best metric, but easy to measure. In particular, this
does not represent a significant reduction in application launch
time.]
Based on measuring the last 10 launches in a lightly used cf AOSP
instance, the system server latency from requesting an app launch to
response with the pid (which does not require the child to execute
anything) went from an average of about 10.7(25) msecs to 6.8(9) and
7.9(16) in two tries with the CL. (The parenthetical numbers are
maxima from among the 10; the variance appears to have decreased
appreciably.)
Dirty pages:
The number of private dirty pages in the zygote itself appears to have
decreased from about 4000 to about 2200. The number of dalvik-main
private dirty pages went from about 1500 to nearly zero.
Initially ART benchmarking service claim -1.88% in PSS. But this is not
consistently repeatable.
Drive-by fix:
Call setAllowNetworkingForProcess on usap / native loop path.
Bug: 159631815
Bug: 174211442
Test: Boots AOSP
Change-Id: I90d2e381bada1b6c9857666d5e87372b6a4c1a70
|
|
Change-Id: I2293b78722ba8fc2eb01d7831c1aab76b2d41310
|
|
Wi-Fi tile
For some reason, this is applying the completely wrong color.
Following the code, it should show the default defined
accent_device_default_dark color with an alpha of 0.6.
Remove it to avoid the issue.
Test: Turn off Wi-Fi. Expand Wi-Fi quick tile. Observe pink
color on progress anim is gone.
Change-Id: I2510a7cd90abb71e94b7698a7d28581517eb41b4
|
|
Change-Id: I13dbf3d7f6587d3fcd6591cc0f861b34b6d5561c
|
|
If user powers screen off when partial screenshot UI is visible,
it will hide the UI but leave gestural navigation disabled.
Also the partial screenshot UI would be visible when taking a
new (normal) screenshot.
Change-Id: Ie8138bb0b771ec0e21ceb48e52872c05c946d3b4
|
|
staging/lineage-18.1_merge-android-11.0.0_r43
Android 11.0.0 release 43
* tag 'android-11.0.0_r43':
Use IntentFilter CREATOR directly for serializing ParsedIntentInfo
Don't export HeapDumpProvider.
Don't attach private Notification to A11yEvent when user locked
Merge "BG-FGS-start while-in-use permission restriction improvement." into rvc-dev am: e51f884f6a
Avoid locking profile task when it is already lock
Improve ellipsize performance
Fix side effects of trace-ipc and dumpheap commands
DO NOT MERGE Add cross-user check for getDefaultSmsPackage().
Remove ParsedIntentInfo CREATOR
Fix race condition between lockNow() and updateLockscreenTimeout
Conflicts:
services/core/java/com/android/server/policy/PhoneWindowManager.java
Change-Id: I6a9a3e341be1fccaa568b875d4d9959d8f068794
|
|
This reverts commit 2992a1dac025074726364d522cf9eac586f3d2c3.
* This commit is present in android-11.0.0_r40, but not in
android-11.0.0_r43 since that's on top of android-11.0.0_r39
* Just revert this to match what's shipping in r43
Change-Id: I8fe467db3bbf5aa40c10c4e1311829a733373279
|
|
This change prevents triggering partial screenshot when trying to take
full screenshot of protected window.
Change-Id: I42a67ed1ee34edffccc6dacd17ba1dffc8d194b3
|
|
The crash happens when you try to uninstall current tts
engine and install a different one and then engine name
may be null.
If engine name is null then you can't select new engine
because of that crash, so that whole tts feature becomes
unusable.
Change-Id: Ie31a947eb6444242e8536db2dae1452ef74cc1ce
|
|
The current update method is triggered in 2 cases:
the SystemUI bluetooth controller changes device state
the battery level changed intent is sent
Sadly the current SysUI controller doesn't handle battery level
changes, and is instead triggered in a few other cases ( ex audio
state changed ).
And since we use the data from SysUI controller for battery level
from changes in the global bt controller we may have 2 different
set of devices to work on. This could ( and does ) trigger
race conditions.
Instead add support battery level state changes within the SystemUI
controller to work on the same data set.
Change-Id: Ib57096fc2ebe151ac3860277a4db2319f230b514
|
|
* Remove unnecessary newlines
* Fix incorrect indentation
* Fix typo in comments
Change-Id: I7d6071f4344605b3dcc3f1c33ac4390f1020e03f
|
|
Change-Id: I944b1122739754cc704f65039319fb260fcdbf1d
|
|
- Only update auto brightness one time when screen is turned on.
- Can be useful on devices where sensor is not accurate.
Change-Id: I5187fdb7765550d4eaa999317ab95f487d44c8d8
|
|
Change-Id: I32f53e719e6c274a78cfdafe71efb4a18d3f9f21
|
|
15566999, 15567396, 15567397, 15567412, 15567413, 15567096, 15567448, 15567449, 15567097, 15567098, 15567450, 15567099, 15567398, 15567100, 15567621, 15567622, 15567468, 15567000] into rvc-qpr3-release
Change-Id: I08d004280a03c61956f90404202a01d02ba05bc4
|
|
In stopVpnProfile(), it doesn't check if the caller's package
name is the same as the given one, so any app has chance to stop
the VPN profile of other apps.
Bug: 191382886
Test: atest FrameworksNetTests CtsNetTestCases \
CtsHostsideNetworkTests:HostsideVpnTests
Change-Id: Ib0a6e9ed191ff8c8bd55ce9902d894b6a339ace2
Merged-In: I254ffd1c08ec058d594b4ea55cbae5505f8497cc
(cherry picked from commit f3072fcd46112bad7c5f6ddd4cc35d2c67f00d11)
|