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

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

Merge "Removing unused debug overlay code."

parents 437c5070 dab26488
Loading
Loading
Loading
Loading
+0 −6
Original line number Diff line number Diff line
@@ -39,12 +39,6 @@
           android:layout_width="match_parent"
           android:layout_height="match_parent" />

    <!-- Debug Overlay View -->
    <ViewStub android:id="@+id/debug_overlay_stub"
           android:layout="@layout/recents_debug_overlay"
           android:layout_width="match_parent"
           android:layout_height="match_parent" />

    <!-- Nav Bar Scrim View -->
    <ImageView
        android:id="@+id/nav_bar_scrim"
+0 −35
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2014 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at
  
          http://www.apache.org/licenses/LICENSE-2.0
  
     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->
<com.android.systemui.recents.views.DebugOverlayView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent" 
    android:layout_height="match_parent"
    android:focusable="false">
    <SeekBar
        android:id="@+id/debug_seek_bar_1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="top"
        android:layout_marginTop="25dp" />
    <SeekBar
        android:id="@+id/debug_seek_bar_2"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="top"
        android:layout_marginTop="50dp" />
</com.android.systemui.recents.views.DebugOverlayView>

+0 −7
Original line number Diff line number Diff line
@@ -29,8 +29,6 @@ public class Constants {
    }

    public static class DebugFlags {
        // Enable this with any other debug flag to see more info
        public static final boolean Verbose = false;

        public static class App {
            // Enables debug drawing for the transition thumbnail
@@ -39,10 +37,6 @@ public class Constants {
            public static final boolean EnableTaskFiltering = false;
            // Enables dismiss-all
            public static final boolean EnableDismissAll = false;
            // Enables debug mode
            public static final boolean EnableDebugMode = false;
            // Enables the search bar layout
            public static final boolean EnableSearchLayout = true;
            // Enables the thumbnail alpha on the front-most task
            public static final boolean EnableThumbnailAlphaOnFrontmost = false;
            // This disables the bitmap and icon caches
@@ -63,7 +57,6 @@ public class Constants {
    public static class Values {
        public static class App {
            public static int AppWidgetHostId = 1024;
            public static String DebugModeVersion = "A";
        }

        public static class TaskStackView {
+1 −76
Original line number Diff line number Diff line
@@ -38,14 +38,12 @@ import com.android.internal.logging.MetricsLogger;
import com.android.systemui.Prefs;
import com.android.systemui.R;
import com.android.systemui.recents.misc.Console;
import com.android.systemui.recents.misc.DebugTrigger;
import com.android.systemui.recents.misc.ReferenceCountedTrigger;
import com.android.systemui.recents.misc.SystemServicesProxy;
import com.android.systemui.recents.model.RecentsTaskLoadPlan;
import com.android.systemui.recents.model.RecentsTaskLoader;
import com.android.systemui.recents.model.Task;
import com.android.systemui.recents.model.TaskStack;
import com.android.systemui.recents.views.DebugOverlayView;
import com.android.systemui.recents.views.RecentsView;
import com.android.systemui.recents.views.SystemBarScrimViews;
import com.android.systemui.recents.views.ViewAnimation;
@@ -57,8 +55,7 @@ import java.util.ArrayList;
 * The main Recents activity that is started from AlternateRecentsComponent.
 */
public class RecentsActivity extends Activity implements RecentsView.RecentsViewCallbacks,
        RecentsAppWidgetHost.RecentsAppWidgetHostCallbacks,
        DebugOverlayView.DebugOverlayViewCallbacks {
        RecentsAppWidgetHost.RecentsAppWidgetHostCallbacks {

    RecentsConfiguration mConfig;
    long mLastTabKeyEventTime;
@@ -67,9 +64,7 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
    RecentsView mRecentsView;
    SystemBarScrimViews mScrimViews;
    ViewStub mEmptyViewStub;
    ViewStub mDebugOverlayStub;
    View mEmptyView;
    DebugOverlayView mDebugOverlay;

    // Resize task debug
    RecentsResizeTaskDialog mResizeTaskDebugDialog;
@@ -176,16 +171,6 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
        }
    };

    /**
     * A custom debug trigger to listen for a debug key chord.
     */
    final DebugTrigger mDebugTrigger = new DebugTrigger(new Runnable() {
        @Override
        public void run() {
            onDebugModeTriggered();
        }
    });

    /** Updates the set of recent tasks */
    void updateRecentsTasks() {
        // If AlternateRecentsComponent has preloaded a load plan, then use that to prevent
@@ -352,9 +337,7 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
                View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN |
                View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
        mEmptyViewStub = (ViewStub) findViewById(R.id.empty_view_stub);
        mDebugOverlayStub = (ViewStub) findViewById(R.id.debug_overlay_stub);
        mScrimViews = new SystemBarScrimViews(this, mConfig);
        inflateDebugOverlay();

        // Bind the search app widget when we first start up
        mSearchWidgetInfo = ssp.getOrBindSearchAppWidget(this, mAppWidgetHost);
@@ -366,27 +349,10 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
        registerReceiver(mSystemBroadcastReceiver, filter);
    }

    /** Inflates the debug overlay if debug mode is enabled. */
    void inflateDebugOverlay() {
        if (!Constants.DebugFlags.App.EnableDebugMode) return;

        if (mConfig.debugModeEnabled && mDebugOverlay == null) {
            // Inflate the overlay and seek bars
            mDebugOverlay = (DebugOverlayView) mDebugOverlayStub.inflate();
            mDebugOverlay.setCallbacks(this);
            mRecentsView.setDebugOverlay(mDebugOverlay);
        }
    }

    @Override
    protected void onNewIntent(Intent intent) {
        super.onNewIntent(intent);
        setIntent(intent);

        // Clear any debug rects
        if (mDebugOverlay != null) {
            mDebugOverlay.clear();
        }
    }

    @Override
@@ -538,8 +504,6 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
            default:
                break;
        }
        // Pass through the debug trigger
        mDebugTrigger.onKeyEvent(keyCode);
        return super.onKeyDown(keyCode, event);
    }

@@ -557,33 +521,6 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
        dismissRecentsToFocusedTaskOrHome(true);
    }

    /** Called when debug mode is triggered */
    public void onDebugModeTriggered() {
        if (mConfig.developerOptionsEnabled) {
            if (Prefs.getBoolean(this, Prefs.Key.DEBUG_MODE_ENABLED, false /* boolean */)) {
                // Disable the debug mode
                Prefs.remove(this, Prefs.Key.DEBUG_MODE_ENABLED);
                mConfig.debugModeEnabled = false;
                inflateDebugOverlay();
                if (mDebugOverlay != null) {
                    mDebugOverlay.disable();
                }
            } else {
                // Enable the debug mode
                Prefs.putBoolean(this, Prefs.Key.DEBUG_MODE_ENABLED, true);
                mConfig.debugModeEnabled = true;
                inflateDebugOverlay();
                if (mDebugOverlay != null) {
                    mDebugOverlay.enable();
                }
            }
            Toast.makeText(this, "Debug mode (" + Constants.Values.App.DebugModeVersion + ") " +
                (mConfig.debugModeEnabled ? "Enabled" : "Disabled") + ", please restart Recents now",
                Toast.LENGTH_SHORT).show();
        }
    }


    /**** RecentsResizeTaskDialog ****/

    private RecentsResizeTaskDialog getResizeTaskDebugDialog() {
@@ -655,16 +592,4 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
            mRecentsView.setSearchBar(null);
        }
    }

    /**** DebugOverlayView.DebugOverlayViewCallbacks ****/

    @Override
    public void onPrimarySeekBarChanged(float progress) {
        // Do nothing
    }

    @Override
    public void onSecondarySeekBarChanged(float progress) {
        // Do nothing
    }
}
+0 −70
Original line number Diff line number Diff line
/*
 * Copyright (C) 2014 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.systemui.recents.misc;

import android.os.Handler;
import android.os.SystemClock;
import android.view.KeyEvent;
import com.android.systemui.recents.Constants;

/**
 * A trigger for catching a debug chord.
 * We currently use volume up then volume down to trigger this mode.
 */
public class DebugTrigger {

    Handler mHandler;
    Runnable mTriggeredRunnable;

    int mLastKeyCode;
    long mLastKeyCodeTime;

    public DebugTrigger(Runnable triggeredRunnable) {
        mHandler = new Handler();
        mTriggeredRunnable = triggeredRunnable;
    }

    /** Resets the debug trigger */
    void reset() {
        mLastKeyCode = 0;
        mLastKeyCodeTime = 0;
    }

    /**
     * Processes a key event and tests if it is a part of the trigger. If the chord is complete,
     * then we just call the callback.
     */
    public void onKeyEvent(int keyCode) {
        if (!Constants.DebugFlags.App.EnableDebugMode) return;

        if (mLastKeyCode == 0) {
            if (keyCode == KeyEvent.KEYCODE_VOLUME_UP) {
                mLastKeyCode = keyCode;
                mLastKeyCodeTime = SystemClock.uptimeMillis();
                return;
            }
        } else {
            if (mLastKeyCode == KeyEvent.KEYCODE_VOLUME_UP &&
                    keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) {
                if ((SystemClock.uptimeMillis() - mLastKeyCodeTime) < 750) {
                    mTriggeredRunnable.run();
                }
            }
        }
        reset();
    }
}
Loading