summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/java/android/app/WallpaperManager.java15
-rw-r--r--packages/SystemUI/src/com/android/systemui/wallpapers/ImageWallpaper.java18
2 files changed, 32 insertions, 1 deletions
diff --git a/core/java/android/app/WallpaperManager.java b/core/java/android/app/WallpaperManager.java
index d660078a9ae7..0a4a4c92915d 100644
--- a/core/java/android/app/WallpaperManager.java
+++ b/core/java/android/app/WallpaperManager.java
@@ -75,6 +75,7 @@ import android.os.ParcelFileDescriptor;
import android.os.RemoteException;
import android.os.StrictMode;
import android.os.SystemProperties;
+import android.os.Trace;
import android.text.TextUtils;
import android.util.ArrayMap;
import android.util.ArraySet;
@@ -612,11 +613,14 @@ public class WallpaperManager {
ColorManagementProxy cmProxy) {
if (mService != null) {
try {
+ Trace.beginSection("WPMS.isWallpaperSupported");
if (!mService.isWallpaperSupported(context.getOpPackageName())) {
return null;
}
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
+ } finally {
+ Trace.endSection();
}
}
synchronized (this) {
@@ -627,6 +631,7 @@ public class WallpaperManager {
mCachedWallpaper = null;
Bitmap currentWallpaper = null;
try {
+ Trace.beginSection("WPMS.getCurrentWallpaperLocked");
currentWallpaper = getCurrentWallpaperLocked(
context, which, userId, hardware, cmProxy);
} catch (OutOfMemoryError e) {
@@ -652,6 +657,8 @@ public class WallpaperManager {
// Post-O apps really most sincerely need the permission.
throw e;
}
+ } finally {
+ Trace.endSection();
}
if (currentWallpaper != null) {
mCachedWallpaper = new CachedWallpaper(currentWallpaper, userId, which);
@@ -730,9 +737,11 @@ public class WallpaperManager {
try {
Bundle params = new Bundle();
+ Trace.beginSection("WPMS.getWallpaperWithFeature_" + which);
ParcelFileDescriptor pfd = mService.getWallpaperWithFeature(
context.getOpPackageName(), context.getAttributionTag(), this, which,
params, userId, /* getCropped = */ true);
+ Trace.endSection();
if (pfd != null) {
try (BufferedInputStream bis = new BufferedInputStream(
@@ -762,13 +771,18 @@ public class WallpaperManager {
}
private Bitmap getDefaultWallpaper(Context context, @SetWallpaperFlags int which) {
+ Trace.beginSection("WPMS.getDefaultWallpaper_" + which);
Bitmap defaultWallpaper = mDefaultWallpaper;
if (defaultWallpaper == null || defaultWallpaper.isRecycled()) {
defaultWallpaper = null;
+ Trace.beginSection("WPMS.openDefaultWallpaper");
try (InputStream is = openDefaultWallpaper(context, which)) {
+ Trace.endSection();
if (is != null) {
BitmapFactory.Options options = new BitmapFactory.Options();
+ Trace.beginSection("WPMS.decodeStream");
defaultWallpaper = BitmapFactory.decodeStream(is, null, options);
+ Trace.endSection();
}
} catch (OutOfMemoryError | IOException e) {
Log.w(TAG, "Can't decode stream", e);
@@ -777,6 +791,7 @@ public class WallpaperManager {
synchronized (this) {
mDefaultWallpaper = defaultWallpaper;
}
+ Trace.endSection();
return defaultWallpaper;
}
diff --git a/packages/SystemUI/src/com/android/systemui/wallpapers/ImageWallpaper.java b/packages/SystemUI/src/com/android/systemui/wallpapers/ImageWallpaper.java
index fdf5966419b4..20fef927e8d1 100644
--- a/packages/SystemUI/src/com/android/systemui/wallpapers/ImageWallpaper.java
+++ b/packages/SystemUI/src/com/android/systemui/wallpapers/ImageWallpaper.java
@@ -317,10 +317,11 @@ public class ImageWallpaper extends WallpaperService {
}
private void loadWallpaperAndDrawFrameInternal() {
- Trace.beginSection("ImageWallpaper.CanvasEngine#loadWallpaper");
+ Trace.beginSection("WPMS.ImageWallpaper.CanvasEngine#loadWallpaper");
boolean loadSuccess = false;
Bitmap bitmap;
try {
+ Trace.beginSection("WPMS.getBitmapAsUser");
bitmap = mWallpaperManager.getBitmapAsUser(
mUserTracker.getUserId(), false, getSourceFlag(), true);
if (bitmap != null
@@ -333,15 +334,22 @@ public class ImageWallpaper extends WallpaperService {
// be loaded, we will go into a cycle. Don't do a build where the
// default wallpaper can't be loaded.
Log.w(TAG, "Unable to load wallpaper!", exception);
+ Trace.beginSection("WPMS.clearWallpaper");
mWallpaperManager.clearWallpaper(getWallpaperFlags(), mUserTracker.getUserId());
+ Trace.endSection();
try {
+ Trace.beginSection("WPMS.getBitmapAsUser_defaultWallpaper");
bitmap = mWallpaperManager.getBitmapAsUser(
mUserTracker.getUserId(), false, getSourceFlag(), true);
} catch (RuntimeException | OutOfMemoryError e) {
Log.w(TAG, "Unable to load default wallpaper!", e);
bitmap = null;
+ } finally {
+ Trace.endSection();
}
+ } finally {
+ Trace.endSection();
}
if (bitmap == null) {
@@ -355,15 +363,23 @@ public class ImageWallpaper extends WallpaperService {
loadSuccess = true;
// recycle the previously loaded bitmap
if (mBitmap != null) {
+ Trace.beginSection("WPMS.mBitmap.recycle");
mBitmap.recycle();
+ Trace.endSection();
}
mBitmap = bitmap;
+ Trace.beginSection("WPMS.wallpaperSupportsWcg");
mWideColorGamut = mWallpaperManager.wallpaperSupportsWcg(getSourceFlag());
+ Trace.endSection();
// +2 usages for the color extraction and the delayed unload.
mBitmapUsages += 2;
+ Trace.beginSection("WPMS.recomputeColorExtractorMiniBitmap");
recomputeColorExtractorMiniBitmap();
+ Trace.endSection();
+ Trace.beginSection("WPMS.drawFrameInternal");
drawFrameInternal();
+ Trace.endSection();
/*
* after loading, the bitmap will be unloaded after all these conditions: