From 5e1e779098b4aa4bb6e8587f8b82651d84356a93 Mon Sep 17 00:00:00 2001 From: Ben Lin Date: Mon, 19 Sep 2016 16:12:05 -0700 Subject: [PATCH] DO NOT MERGE ANYWHERE Remove onBeforePop() logic so back no longer opens/closes drawer. Bug: 30814333 Change-Id: I4f6fc2a353286f69b88e5340145f7f9b3a97e819 --- .../com/android/documentsui/BaseActivity.java | 12 +----- .../android/documentsui/FilesActivity.java | 39 ------------------- 2 files changed, 1 insertion(+), 50 deletions(-) diff --git a/packages/DocumentsUI/src/com/android/documentsui/BaseActivity.java b/packages/DocumentsUI/src/com/android/documentsui/BaseActivity.java index 1922773c9cb8f..46e7fe0b30539 100644 --- a/packages/DocumentsUI/src/com/android/documentsui/BaseActivity.java +++ b/packages/DocumentsUI/src/com/android/documentsui/BaseActivity.java @@ -612,23 +612,13 @@ public abstract class BaseActivity extends Activity return; } - if (!mState.hasLocationChanged()) { - super.onBackPressed(); - return; - } - - if (onBeforePopDir() || popDir()) { + if (popDir()) { return; } super.onBackPressed(); } - boolean onBeforePopDir() { - // Files app overrides this with some fancy logic. - return false; - } - public void onStackPicked(DocumentStack stack) { try { // Update the restored stack to ensure we have freshest data diff --git a/packages/DocumentsUI/src/com/android/documentsui/FilesActivity.java b/packages/DocumentsUI/src/com/android/documentsui/FilesActivity.java index 728d98f56e382..3b1ca77b680ad 100644 --- a/packages/DocumentsUI/src/com/android/documentsui/FilesActivity.java +++ b/packages/DocumentsUI/src/com/android/documentsui/FilesActivity.java @@ -60,12 +60,6 @@ public class FilesActivity extends BaseActivity { public static final String TAG = "FilesActivity"; - // See comments where this const is referenced for details. - private static final int DRAWER_NO_FIDDLE_DELAY = 1500; - - // Track the time we opened the drawer in response to back being pressed. - // We use the time gap to figure out whether to close app or reopen the drawer. - private long mDrawerLastFiddled; private DocumentClipper mClipper; public FilesActivity() { @@ -395,39 +389,6 @@ public class FilesActivity extends BaseActivity { } } - // Do some "do what a I want" drawer fiddling, but don't - // do it if user already hit back recently and we recently - // did some fiddling. - @Override - boolean onBeforePopDir() { - int size = mState.stack.size(); - - if (mDrawer.isPresent() - && (System.currentTimeMillis() - mDrawerLastFiddled) > DRAWER_NO_FIDDLE_DELAY) { - // Close drawer if it is open. - if (mDrawer.isOpen()) { - mDrawer.setOpen(false); - mDrawerLastFiddled = System.currentTimeMillis(); - return true; - } - - final Intent intent = getIntent(); - final boolean launchedExternally = intent != null && intent.getData() != null - && mState.action == State.ACTION_BROWSE; - - // Open the Close drawer if it is closed and we're at the top of a root, but only when - // not launched by another app. - if (size <= 1 && !launchedExternally) { - mDrawer.setOpen(true); - // Remember so we don't just close it again if back is pressed again. - mDrawerLastFiddled = System.currentTimeMillis(); - return true; - } - } - - return false; - } - // Turns out only DocumentsActivity was ever calling saveStackBlocking. // There may be a case where we want to contribute entries from // Behavior here in FilesActivity, but it isn't yet obvious.