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

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

Merge "Disabling shadowing (until bugs are addressed) and refactoring some constants."

parents ef27453c 814086db
Loading
Loading
Loading
Loading
+16 −16
Original line number Diff line number Diff line
@@ -64,7 +64,7 @@ public class AlternateRecentsComponent {
                mSingleCountFirstTaskRect.offset(0, (int) statusBarHeight);
                mMultipleCountFirstTaskRect = replyData.getParcelable(KEY_MULTIPLE_TASK_STACK_RECT);
                mMultipleCountFirstTaskRect.offset(0, (int) statusBarHeight);
                Console.log(Constants.DebugFlags.App.RecentsComponent,
                Console.log(Constants.Log.App.RecentsComponent,
                        "[RecentsComponent|RecentsMessageHandler|handleMessage]",
                        "singleTaskRect: " + mSingleCountFirstTaskRect +
                        " multipleTaskRect: " + mMultipleCountFirstTaskRect);
@@ -83,7 +83,7 @@ public class AlternateRecentsComponent {
    class RecentsServiceConnection implements ServiceConnection {
        @Override
        public void onServiceConnected(ComponentName className, IBinder service) {
            Console.log(Constants.DebugFlags.App.RecentsComponent,
            Console.log(Constants.Log.App.RecentsComponent,
                    "[RecentsComponent|ServiceConnection|onServiceConnected]",
                    "toggleRecents: " + mToggleRecentsUponServiceBound);
            mService = new Messenger(service);
@@ -103,7 +103,7 @@ public class AlternateRecentsComponent {

        @Override
        public void onServiceDisconnected(ComponentName className) {
            Console.log(Constants.DebugFlags.App.RecentsComponent,
            Console.log(Constants.Log.App.RecentsComponent,
                    "[RecentsComponent|ServiceConnection|onServiceDisconnected]");
            mService = null;
            mServiceIsBound = false;
@@ -154,7 +154,7 @@ public class AlternateRecentsComponent {
    }

    public void onStart() {
        Console.log(Constants.DebugFlags.App.RecentsComponent, "[RecentsComponent|start]");
        Console.log(Constants.Log.App.RecentsComponent, "[RecentsComponent|start]");

        // Try to create a long-running connection to the recents service
        bindToRecentsService(false);
@@ -162,11 +162,11 @@ 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]",
        Console.logStartTracingTime(Constants.Log.App.TimeRecentsStartup,
                Constants.Log.App.TimeRecentsStartupKey);
        Console.logStartTracingTime(Constants.Log.App.TimeRecentsLaunchTask,
                Constants.Log.App.TimeRecentsLaunchKey);
        Console.log(Constants.Log.App.RecentsComponent, "[RecentsComponent|toggleRecents]",
                "serviceIsBound: " + mServiceIsBound);
        mStatusBarView = statusBarView;
        if (!mServiceIsBound) {
@@ -192,7 +192,7 @@ public class AlternateRecentsComponent {
    }

    public void onCloseRecents() {
        Console.log(Constants.DebugFlags.App.RecentsComponent, "[RecentsComponent|closeRecents]");
        Console.log(Constants.Log.App.RecentsComponent, "[RecentsComponent|closeRecents]");
        if (mServiceIsBound) {
            // Try and update the recents configuration
            try {
@@ -400,10 +400,10 @@ public class AlternateRecentsComponent {
                    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");
                    Console.logTraceTime(Constants.Log.App.TimeRecentsStartup,
                            Constants.Log.App.TimeRecentsStartupKey, "sendToggleRecents");
                    Console.logTraceTime(Constants.Log.App.TimeRecentsLaunchTask,
                            Constants.Log.App.TimeRecentsLaunchKey, "sendToggleRecents");
                } catch (RemoteException re) {
                    re.printStackTrace();
                }
@@ -450,8 +450,8 @@ public class AlternateRecentsComponent {
            startAlternateRecentsActivity(opts, false);
        }

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

+13 −9
Original line number Diff line number Diff line
@@ -18,7 +18,6 @@ package com.android.systemui.recents;

/**
 * Constants
 * XXX: We are going to move almost all of these into a resource.
 */
public class Constants {
    public static class DebugFlags {
@@ -26,12 +25,18 @@ public class Constants {
        public static final boolean Verbose = false;

        public static class App {
            // Enables the filtering of tasks according to their grouping
            public static final boolean EnableTaskFiltering = false;
            // Enables clipping of tasks against each other
            public static final boolean EnableTaskStackClipping = false;
            // Enables the use of theme colors as the task bar background
            public static final boolean EnableTaskBarThemeColors = true;
            // Enables the info pane on long-press
            public static final boolean EnableInfoPane = true;
            public static final boolean EnableSearchButton = true;

            // Enables the search bar layout
            public static final boolean EnableSearchLayout = true;
            // Enables the dynamic shadows behind each task
            public static final boolean EnableShadows = false;
            // This disables the bitmap and icon caches
            public static final boolean DisableBackgroundCache = false;
            // For debugging, this enables us to create mock recents tasks
@@ -40,8 +45,11 @@ public class Constants {
            public static final int SystemServicesProxyMockPackageCount = 3;
            // For debugging, this defines the number of mock recents tasks to create
            public static final int SystemServicesProxyMockTaskCount = 75;
        }
    }

            // Timing certain paths
    public static class Log {
        public static class App {
            public static final String TimeRecentsStartupKey = "startup";
            public static final String TimeRecentsLaunchKey = "launchTask";
            public static final boolean TimeRecentsStartup = false;
@@ -72,6 +80,7 @@ public class Constants {
        }
    }

    /** XXX: We are going to move almost all of these into a resource once they are nailed down. */
    public static class Values {
        public static class App {
            public static int AppWidgetHostId = 1024;
@@ -102,10 +111,5 @@ public class Constants {
            // The number of cards we see in the peek space
            public static final int StackPeekNumCards = 3;
        }

        public static class TaskView {
            public static final boolean AnimateFrontTaskBarOnEnterRecents = true;
            public static final boolean AnimateFrontTaskBarOnLeavingRecents = true;
        }
    }
}
 No newline at end of file
+21 −22
Original line number Diff line number Diff line
@@ -25,7 +25,6 @@ import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.util.Pair;
import android.view.LayoutInflater;
@@ -78,7 +77,7 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
        @Override
        public void onReceive(Context context, Intent intent) {
            String action = intent.getAction();
            Console.log(Constants.DebugFlags.App.SystemUIHandshake,
            Console.log(Constants.Log.App.SystemUIHandshake,
                    "[RecentsActivity|serviceBroadcast]", action, Console.AnsiRed);
            if (action.equals(RecentsService.ACTION_TOGGLE_RECENTS_ACTIVITY)) {
                // Try and unfilter and filtered stacks
@@ -134,7 +133,7 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView

    /** Attempts to allocate and bind the search bar app widget */
    void bindSearchBarAppWidget() {
        if (Constants.DebugFlags.App.EnableSearchButton) {
        if (Constants.DebugFlags.App.EnableSearchLayout) {
            RecentsConfiguration config = RecentsConfiguration.getInstance();
            SystemServicesProxy ssp = RecentsTaskLoader.getInstance().getSystemServicesProxy();

@@ -152,7 +151,7 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
                    ssp.unbindSearchAppWidget(mAppWidgetHost, appWidgetId);
                    appWidgetId = -1;
                }
                Console.log(Constants.DebugFlags.App.SystemUIHandshake,
                Console.log(Constants.Log.App.SystemUIHandshake,
                        "[RecentsActivity|onCreate|settings|appWidgetId]",
                        "Id: " + appWidgetId,
                        Console.AnsiBlue);
@@ -163,7 +162,7 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
                Pair<Integer, AppWidgetProviderInfo> widgetInfo =
                        ssp.bindSearchAppWidget(mAppWidgetHost);
                if (widgetInfo != null) {
                    Console.log(Constants.DebugFlags.App.SystemUIHandshake,
                    Console.log(Constants.Log.App.SystemUIHandshake,
                            "[RecentsActivity|onCreate|searchWidget]",
                            "Id: " + widgetInfo.first + " Info: " + widgetInfo.second,
                            Console.AnsiBlue);
@@ -178,11 +177,11 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView

    /** Creates the search bar app widget view */
    void addSearchBarAppWidgetView() {
        if (Constants.DebugFlags.App.EnableSearchButton) {
        if (Constants.DebugFlags.App.EnableSearchLayout) {
            RecentsConfiguration config = RecentsConfiguration.getInstance();
            int appWidgetId = config.searchBarAppWidgetId;
            if (appWidgetId >= 0) {
                Console.log(Constants.DebugFlags.App.SystemUIHandshake,
                Console.log(Constants.Log.App.SystemUIHandshake,
                        "[RecentsActivity|onCreate|addSearchAppWidgetView]",
                        "Id: " + appWidgetId,
                        Console.AnsiBlue);
@@ -216,11 +215,11 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Console.logDivider(Constants.DebugFlags.App.SystemUIHandshake);
        Console.log(Constants.DebugFlags.App.SystemUIHandshake, "[RecentsActivity|onCreate]",
        Console.logDivider(Constants.Log.App.SystemUIHandshake);
        Console.log(Constants.Log.App.SystemUIHandshake, "[RecentsActivity|onCreate]",
                getIntent().getAction() + " visible: " + mVisible, Console.AnsiRed);
        Console.logTraceTime(Constants.DebugFlags.App.TimeRecentsStartup,
                Constants.DebugFlags.App.TimeRecentsStartupKey, "onCreate");
        Console.logTraceTime(Constants.Log.App.TimeRecentsStartup,
                Constants.Log.App.TimeRecentsStartupKey, "onCreate");

        // Initialize the loader and the configuration
        RecentsTaskLoader.initialize(this);
@@ -260,11 +259,11 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
        // 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]",
        Console.logDivider(Constants.Log.App.SystemUIHandshake);
        Console.log(Constants.Log.App.SystemUIHandshake, "[RecentsActivity|onNewIntent]",
                intent.getAction() + " visible: " + mVisible, Console.AnsiRed);
        Console.logTraceTime(Constants.DebugFlags.App.TimeRecentsStartup,
                Constants.DebugFlags.App.TimeRecentsStartupKey, "onNewIntent");
        Console.logTraceTime(Constants.Log.App.TimeRecentsStartup,
                Constants.Log.App.TimeRecentsStartupKey, "onNewIntent");

        // Initialize the loader and the configuration
        RecentsTaskLoader.initialize(this);
@@ -279,7 +278,7 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView

    @Override
    protected void onStart() {
        Console.log(Constants.DebugFlags.App.SystemUIHandshake, "[RecentsActivity|onStart]", "",
        Console.log(Constants.Log.App.SystemUIHandshake, "[RecentsActivity|onStart]", "",
                Console.AnsiRed);
        super.onStart();
        mAppWidgetHost.startListening();
@@ -288,14 +287,14 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView

    @Override
    protected void onResume() {
        Console.log(Constants.DebugFlags.App.SystemUIHandshake, "[RecentsActivity|onResume]", "",
        Console.log(Constants.Log.App.SystemUIHandshake, "[RecentsActivity|onResume]", "",
                Console.AnsiRed);
        super.onResume();
    }

    @Override
    public void onAttachedToWindow() {
        Console.log(Constants.DebugFlags.App.SystemUIHandshake,
        Console.log(Constants.Log.App.SystemUIHandshake,
                "[RecentsActivity|onAttachedToWindow]", "",
                Console.AnsiRed);
        super.onAttachedToWindow();
@@ -313,7 +312,7 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView

    @Override
    public void onDetachedFromWindow() {
        Console.log(Constants.DebugFlags.App.SystemUIHandshake,
        Console.log(Constants.Log.App.SystemUIHandshake,
                "[RecentsActivity|onDetachedFromWindow]", "",
                Console.AnsiRed);
        super.onDetachedFromWindow();
@@ -325,14 +324,14 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView

    @Override
    protected void onPause() {
        Console.log(Constants.DebugFlags.App.SystemUIHandshake, "[RecentsActivity|onPause]", "",
        Console.log(Constants.Log.App.SystemUIHandshake, "[RecentsActivity|onPause]", "",
                Console.AnsiRed);
        super.onPause();
    }

    @Override
    protected void onStop() {
        Console.log(Constants.DebugFlags.App.SystemUIHandshake, "[RecentsActivity|onStop]", "",
        Console.log(Constants.Log.App.SystemUIHandshake, "[RecentsActivity|onStop]", "",
                Console.AnsiRed);
        super.onStop();

@@ -343,7 +342,7 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView

    @Override
    protected void onDestroy() {
        Console.log(Constants.DebugFlags.App.SystemUIHandshake, "[RecentsActivity|onDestroy]", "",
        Console.log(Constants.Log.App.SystemUIHandshake, "[RecentsActivity|onDestroy]", "",
                Console.AnsiRed);
        super.onDestroy();
    }
+2 −2
Original line number Diff line number Diff line
@@ -88,7 +88,7 @@ public class RecentsConfiguration {
                Configuration.ORIENTATION_LANDSCAPE;
        transposeSearchLayoutWithOrientation =
                res.getBoolean(R.bool.recents_transpose_search_layout_with_orientation);
        Console.log(Constants.DebugFlags.UI.MeasureAndLayout,
        Console.log(Constants.Log.UI.MeasureAndLayout,
                "[RecentsConfiguration|orientation]", isLandscape ? "Landscape" : "Portrait",
                Console.AnsiGreen);

@@ -174,7 +174,7 @@ public class RecentsConfiguration {
     */
    public void getSearchBarBounds(int width, int height, Rect searchBarSpaceBounds) {
        // Return empty rects if search is not enabled
        if (!Constants.DebugFlags.App.EnableSearchButton) {
        if (!Constants.DebugFlags.App.EnableSearchLayout) {
            searchBarSpaceBounds.set(0, 0, 0, 0);
            return;
        }
+10 −10
Original line number Diff line number Diff line
@@ -45,7 +45,7 @@ class SystemUIMessageHandler extends Handler {

    @Override
    public void handleMessage(Message msg) {
        Console.log(Constants.DebugFlags.App.SystemUIHandshake,
        Console.log(Constants.Log.App.SystemUIHandshake,
                "[RecentsService|handleMessage]", msg);

        Context context = mContext.get();
@@ -115,10 +115,10 @@ class SystemUIMessageHandler extends Handler {
            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");
            Console.logTraceTime(Constants.Log.App.TimeRecentsStartup,
                    Constants.Log.App.TimeRecentsStartupKey, "receivedToggleRecents");
            Console.logTraceTime(Constants.Log.App.TimeRecentsLaunchTask,
                    Constants.Log.App.TimeRecentsLaunchKey, "receivedToggleRecents");
        }
    }
}
@@ -131,31 +131,31 @@ public class RecentsService extends Service {

    @Override
    public void onCreate() {
        Console.log(Constants.DebugFlags.App.SystemUIHandshake, "[RecentsService|onCreate]");
        Console.log(Constants.Log.App.SystemUIHandshake, "[RecentsService|onCreate]");
        super.onCreate();
    }

    @Override
    public IBinder onBind(Intent intent) {
        Console.log(Constants.DebugFlags.App.SystemUIHandshake, "[RecentsService|onBind]");
        Console.log(Constants.Log.App.SystemUIHandshake, "[RecentsService|onBind]");
        return mSystemUIMessenger.getBinder();
    }

    @Override
    public boolean onUnbind(Intent intent) {
        Console.log(Constants.DebugFlags.App.SystemUIHandshake, "[RecentsService|onUnbind]");
        Console.log(Constants.Log.App.SystemUIHandshake, "[RecentsService|onUnbind]");
        return super.onUnbind(intent);
    }

    @Override
    public void onRebind(Intent intent) {
        Console.log(Constants.DebugFlags.App.SystemUIHandshake, "[RecentsService|onRebind]");
        Console.log(Constants.Log.App.SystemUIHandshake, "[RecentsService|onRebind]");
        super.onRebind(intent);
    }

    @Override
    public void onDestroy() {
        Console.log(Constants.DebugFlags.App.SystemUIHandshake, "[RecentsService|onDestroy]");
        Console.log(Constants.Log.App.SystemUIHandshake, "[RecentsService|onDestroy]");
        super.onDestroy();
    }

Loading