summaryrefslogtreecommitdiffstats
path: root/quickstep/src
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2019-05-23 00:50:08 -0700
committerSunny Goyal <sunnygoyal@google.com>2019-05-23 14:02:33 -0700
commitab3963ddcf3c458d8aa669b89d9cf548f4b48b7e (patch)
tree8f30cdbe19114d4be97f9a84e26a874b24072609 /quickstep/src
parent571e51161cb1e4ab7685aca5b370fba73c5727e6 (diff)
downloadandroid_packages_apps_Trebuchet-ab3963ddcf3c458d8aa669b89d9cf548f4b48b7e.tar.gz
android_packages_apps_Trebuchet-ab3963ddcf3c458d8aa669b89d9cf548f4b48b7e.tar.bz2
android_packages_apps_Trebuchet-ab3963ddcf3c458d8aa669b89d9cf548f4b48b7e.zip
Moving TestInformationProvider to Launcher3 so that it can be used for
testing Launcher3 without quickstep Also keeping the provider as disabled until needed Change-Id: Ib5f459e02ae551724b390f3b74f43d601568d749
Diffstat (limited to 'quickstep/src')
-rw-r--r--quickstep/src/com/android/quickstep/QuickstepTestInformationHandler.java36
-rw-r--r--quickstep/src/com/android/quickstep/TestInformationProvider.java127
2 files changed, 36 insertions, 127 deletions
diff --git a/quickstep/src/com/android/quickstep/QuickstepTestInformationHandler.java b/quickstep/src/com/android/quickstep/QuickstepTestInformationHandler.java
new file mode 100644
index 000000000..89513634f
--- /dev/null
+++ b/quickstep/src/com/android/quickstep/QuickstepTestInformationHandler.java
@@ -0,0 +1,36 @@
+package com.android.quickstep;
+
+import android.content.Context;
+import android.os.Bundle;
+
+import com.android.launcher3.testing.TestInformationHandler;
+import com.android.launcher3.testing.TestProtocol;
+import com.android.launcher3.uioverrides.states.OverviewState;
+import com.android.quickstep.util.LayoutUtils;
+
+public class QuickstepTestInformationHandler extends TestInformationHandler {
+
+ public QuickstepTestInformationHandler(Context context) { }
+
+ @Override
+ public Bundle call(String method) {
+ final Bundle response = new Bundle();
+ switch (method) {
+ case TestProtocol.REQUEST_HOME_TO_OVERVIEW_SWIPE_HEIGHT: {
+ final float swipeHeight =
+ OverviewState.getDefaultSwipeHeight(mDeviceProfile);
+ response.putInt(TestProtocol.TEST_INFO_RESPONSE_FIELD, (int) swipeHeight);
+ return response;
+ }
+
+ case TestProtocol.REQUEST_BACKGROUND_TO_OVERVIEW_SWIPE_HEIGHT: {
+ final float swipeHeight =
+ LayoutUtils.getShelfTrackingDistance(mContext, mDeviceProfile);
+ response.putInt(TestProtocol.TEST_INFO_RESPONSE_FIELD, (int) swipeHeight);
+ return response;
+ }
+ }
+
+ return super.call(method);
+ }
+}
diff --git a/quickstep/src/com/android/quickstep/TestInformationProvider.java b/quickstep/src/com/android/quickstep/TestInformationProvider.java
deleted file mode 100644
index d96f9af6f..000000000
--- a/quickstep/src/com/android/quickstep/TestInformationProvider.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Copyright (C) 2019 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.quickstep;
-
-import android.content.ContentProvider;
-import android.content.ContentValues;
-import android.content.Context;
-import android.database.Cursor;
-import android.net.Uri;
-import android.os.Bundle;
-
-import com.android.launcher3.DeviceProfile;
-import com.android.launcher3.InvariantDeviceProfile;
-import com.android.launcher3.Launcher;
-import com.android.launcher3.LauncherAppState;
-import com.android.launcher3.LauncherState;
-import com.android.launcher3.TestProtocol;
-import com.android.launcher3.Utilities;
-import com.android.launcher3.uioverrides.states.OverviewState;
-import com.android.quickstep.util.LayoutUtils;
-
-public class TestInformationProvider extends ContentProvider {
- @Override
- public boolean onCreate() {
- return true;
- }
-
- @Override
- public int update(Uri uri, ContentValues contentValues, String s, String[] strings) {
- return 0;
- }
-
- @Override
- public int delete(Uri uri, String s, String[] strings) {
- return 0;
- }
-
- @Override
- public Uri insert(Uri uri, ContentValues contentValues) {
- return null;
- }
-
- @Override
- public String getType(Uri uri) {
- return null;
- }
-
- @Override
- public Cursor query(Uri uri, String[] strings, String s, String[] strings1, String s1) {
- return null;
- }
-
- @Override
- public Bundle call(String method, String arg, Bundle extras) {
- if (Utilities.IS_RUNNING_IN_TEST_HARNESS) {
- final Bundle response = new Bundle();
- final Context context = getContext();
- final DeviceProfile deviceProfile = InvariantDeviceProfile.INSTANCE.
- get(context).getDeviceProfile(context);
- final LauncherAppState launcherAppState = LauncherAppState.getInstanceNoCreate();
- final Launcher launcher = launcherAppState != null ?
- (Launcher) launcherAppState.getModel().getCallback() : null;
-
- switch (method) {
- case TestProtocol.REQUEST_HOME_TO_OVERVIEW_SWIPE_HEIGHT: {
- final float swipeHeight =
- OverviewState.getDefaultSwipeHeight(deviceProfile);
- response.putInt(TestProtocol.TEST_INFO_RESPONSE_FIELD, (int) swipeHeight);
- break;
- }
-
- case TestProtocol.REQUEST_BACKGROUND_TO_OVERVIEW_SWIPE_HEIGHT: {
- final float swipeHeight =
- LayoutUtils.getShelfTrackingDistance(context, deviceProfile);
- response.putInt(TestProtocol.TEST_INFO_RESPONSE_FIELD, (int) swipeHeight);
- break;
- }
-
- case TestProtocol.REQUEST_ALL_APPS_TO_OVERVIEW_SWIPE_HEIGHT: {
- if (launcher == null) return null;
-
- final float progress = LauncherState.OVERVIEW.getVerticalProgress(launcher)
- - LauncherState.ALL_APPS.getVerticalProgress(launcher);
- final float distance =
- launcher.getAllAppsController().getShiftRange() * progress;
- response.putInt(TestProtocol.TEST_INFO_RESPONSE_FIELD, (int) distance);
- break;
- }
-
- case TestProtocol.REQUEST_HOME_TO_ALL_APPS_SWIPE_HEIGHT: {
- if (launcher == null) return null;
-
- final float progress = LauncherState.NORMAL.getVerticalProgress(launcher)
- - LauncherState.ALL_APPS.getVerticalProgress(launcher);
- final float distance =
- launcher.getAllAppsController().getShiftRange() * progress;
- response.putInt(TestProtocol.TEST_INFO_RESPONSE_FIELD, (int) distance);
- break;
- }
-
- case TestProtocol.REQUEST_ENABLE_DEBUG_TRACING:
- TestProtocol.sDebugTracing = true;
- break;
-
- case TestProtocol.REQUEST_DISABLE_DEBUG_TRACING:
- TestProtocol.sDebugTracing = false;
- break;
- }
- return response;
- }
- return null;
- }
-}