Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 828698b0 authored by John Reck's avatar John Reck
Browse files

Make querying the graphics stats service more defensive

Bug: 21750734

Doesn't fix the underlying issue that we were unable to
get a buffer but as this is non-critical be more defensive
about failures.

Change-Id: I7f2faaa35b064e3d0da0a13dba9aae3c226b9acc
parent e3fc5415
Loading
Loading
Loading
Loading
+8 −9
Original line number Diff line number Diff line
@@ -434,7 +434,6 @@ public class ThreadedRenderer extends HardwareRenderer {

    private static class ProcessInitializer {
        static ProcessInitializer sInstance = new ProcessInitializer();
        static IGraphicsStats sGraphicsStatsService;
        private static IBinder sProcToken;

        private boolean mInitialized = false;
@@ -449,19 +448,19 @@ public class ThreadedRenderer extends HardwareRenderer {
        }

        private static void initGraphicsStats(Context context, long renderProxy) {
            try {
                IBinder binder = ServiceManager.getService("graphicsstats");
                if (binder == null) return;

            sGraphicsStatsService = IGraphicsStats.Stub.asInterface(binder);
                IGraphicsStats graphicsStatsService = IGraphicsStats.Stub
                        .asInterface(binder);
                sProcToken = new Binder();
            try {
                final String pkg = context.getApplicationInfo().packageName;
                ParcelFileDescriptor pfd = sGraphicsStatsService.
                ParcelFileDescriptor pfd = graphicsStatsService.
                        requestBufferForProcess(pkg, sProcToken);
                nSetProcessStatsBuffer(renderProxy, pfd.getFd());
                pfd.close();
            } catch (Exception e) {
                Log.w(LOG_TAG, "Could not acquire gfx stats buffer", e);
            } catch (Throwable t) {
                Log.w(LOG_TAG, "Could not acquire gfx stats buffer", t);
            }
        }