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

Commit 1bcb248d authored by Winson Chung's avatar Winson Chung Committed by Android (Google) Code Review
Browse files

Merge "Fixing issue where launching a task was delayed due to a previous start...

Merge "Fixing issue where launching a task was delayed due to a previous start delay being set on a ViewPropertyAnimator."
parents 9d8ff51c bd91297e
Loading
Loading
Loading
Loading
+14 −1
Original line number Diff line number Diff line
@@ -105,7 +105,7 @@ public class AlternateRecentsComponent {
    final static int MSG_CLOSE_RECENTS = 4;
    final static int MSG_TOGGLE_RECENTS = 5;

    final static int sMinToggleDelay = 475;
    final static int sMinToggleDelay = 425;

    final static String sToggleRecentsAction = "com.android.systemui.recents.SHOW_RECENTS";
    final static String sRecentsPackage = "com.android.systemui";
@@ -139,6 +139,10 @@ public class AlternateRecentsComponent {

    /** Toggles the alternate recents activity */
    public void onToggleRecents(Display display, int layoutDirection, View statusBarView) {
        Console.logStartTracingTime(Constants.DebugFlags.App.TimeRecentsStartup,
                Constants.DebugFlags.App.TimeRecentsStartupKey);
        Console.logStartTracingTime(Constants.DebugFlags.App.TimeRecentsLaunchTask,
                Constants.DebugFlags.App.TimeRecentsLaunchKey);
        Console.log(Constants.DebugFlags.App.RecentsComponent, "[RecentsComponent|toggleRecents]",
                "serviceIsBound: " + mServiceIsBound);
        mStatusBarView = statusBarView;
@@ -304,6 +308,12 @@ public class AlternateRecentsComponent {
                    Message msg = Message.obtain(null, MSG_TOGGLE_RECENTS, 0, 0);
                    msg.setData(data);
                    mService.send(msg);

                    // Time this path
                    Console.logTraceTime(Constants.DebugFlags.App.TimeRecentsStartup,
                            Constants.DebugFlags.App.TimeRecentsStartupKey, "sendToggleRecents");
                    Console.logTraceTime(Constants.DebugFlags.App.TimeRecentsLaunchTask,
                            Constants.DebugFlags.App.TimeRecentsLaunchKey, "sendToggleRecents");
                } catch (RemoteException re) {
                    re.printStackTrace();
                }
@@ -357,6 +367,9 @@ public class AlternateRecentsComponent {
                    R.anim.recents_from_launcher_exit);
            startAlternateRecentsActivity(opts);
        }

        Console.logTraceTime(Constants.DebugFlags.App.TimeRecentsStartup,
                Constants.DebugFlags.App.TimeRecentsStartupKey, "startRecentsActivity");
        mLastToggleTime = System.currentTimeMillis();
    }

+26 −0
Original line number Diff line number Diff line
@@ -23,7 +23,14 @@ import android.util.Log;
import android.view.MotionEvent;
import android.widget.Toast;

import java.util.HashMap;
import java.util.Map;


public class Console {
    // Timer
    public static final Map<Object, Long> mTimeLogs = new HashMap<Object, Long>();

    // Colors
    public static final String AnsiReset = "\u001B[0m";
    public static final String AnsiBlack = "\u001B[30m";
@@ -80,6 +87,25 @@ public class Console {
        }
    }

    /** Starts a time trace */
    public static void logStartTracingTime(boolean condition, String key) {
        if (condition) {
            long curTime = System.currentTimeMillis();
            mTimeLogs.put(key, curTime);
            Console.log(condition, "[Recents|" + key + "]",
                    "started @ " + curTime);
        }
    }

    /** Continues a time trace */
    public static void logTraceTime(boolean condition, String key, String desc) {
        if (condition) {
            long timeDiff = System.currentTimeMillis() - mTimeLogs.get(key);
            Console.log(condition, "[Recents|" + key + "|" + desc + "]",
                    "+" + timeDiff + "ms");
        }
    }

    /** Logs a stack trace */
    public static void logStackTrace() {
        logStackTrace("", 99);
+6 −0
Original line number Diff line number Diff line
@@ -32,6 +32,12 @@ public class Constants {
            // This disables the bitmap and icon caches to
            public static final boolean DisableBackgroundCache = false;

            // Timing certain paths
            public static final String TimeRecentsStartupKey = "startup";
            public static final String TimeRecentsLaunchKey = "launchTask";
            public static final boolean TimeRecentsStartup = false;
            public static final boolean TimeRecentsLaunchTask = false;

            public static final boolean RecentsComponent = false;
            public static final boolean TaskDataLoader = false;
            public static final boolean SystemUIHandshake = false;
+4 −1
Original line number Diff line number Diff line
@@ -101,6 +101,8 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
        Console.logDivider(Constants.DebugFlags.App.SystemUIHandshake);
        Console.log(Constants.DebugFlags.App.SystemUIHandshake, "[RecentsActivity|onCreate]",
                getIntent().getAction() + " visible: " + mVisible, Console.AnsiRed);
        Console.logTraceTime(Constants.DebugFlags.App.TimeRecentsStartup,
                Constants.DebugFlags.App.TimeRecentsStartupKey, "onCreate");

        // Initialize the loader and the configuration
        RecentsTaskLoader.initialize(this);
@@ -135,13 +137,14 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
    @Override
    protected void onNewIntent(Intent intent) {
        super.onNewIntent(intent);

        // Reset the task launched flag if we encounter an onNewIntent() before onStop()
        mTaskLaunched = false;

        Console.logDivider(Constants.DebugFlags.App.SystemUIHandshake);
        Console.log(Constants.DebugFlags.App.SystemUIHandshake, "[RecentsActivity|onNewIntent]",
                intent.getAction() + " visible: " + mVisible, Console.AnsiRed);
        Console.logTraceTime(Constants.DebugFlags.App.TimeRecentsStartup,
                Constants.DebugFlags.App.TimeRecentsStartupKey, "onNewIntent");

        // Initialize the loader and the configuration
        RecentsTaskLoader.initialize(this);
+6 −0
Original line number Diff line number Diff line
@@ -84,6 +84,12 @@ class SystemUIMessageHandler extends Handler {
            Intent intent = new Intent(RecentsService.ACTION_TOGGLE_RECENTS_ACTIVITY);
            intent.setPackage(context.getPackageName());
            context.sendBroadcast(intent);

            // Time this path
            Console.logTraceTime(Constants.DebugFlags.App.TimeRecentsStartup,
                    Constants.DebugFlags.App.TimeRecentsStartupKey, "receivedToggleRecents");
            Console.logTraceTime(Constants.DebugFlags.App.TimeRecentsLaunchTask,
                    Constants.DebugFlags.App.TimeRecentsLaunchKey, "receivedToggleRecents");
        }
    }
}
Loading