diff options
author | Sunny Goyal <sunnygoyal@google.com> | 2019-05-23 00:50:08 -0700 |
---|---|---|
committer | Sunny Goyal <sunnygoyal@google.com> | 2019-05-23 14:02:33 -0700 |
commit | ab3963ddcf3c458d8aa669b89d9cf548f4b48b7e (patch) | |
tree | 8f30cdbe19114d4be97f9a84e26a874b24072609 /quickstep | |
parent | 571e51161cb1e4ab7685aca5b370fba73c5727e6 (diff) | |
download | android_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')
-rw-r--r-- | quickstep/AndroidManifest.xml | 8 | ||||
-rw-r--r-- | quickstep/res/values/config.xml | 2 | ||||
-rw-r--r-- | quickstep/src/com/android/quickstep/QuickstepTestInformationHandler.java | 36 | ||||
-rw-r--r-- | quickstep/src/com/android/quickstep/TestInformationProvider.java | 127 |
4 files changed, 38 insertions, 135 deletions
diff --git a/quickstep/AndroidManifest.xml b/quickstep/AndroidManifest.xml index be275e0e8..a38979d41 100644 --- a/quickstep/AndroidManifest.xml +++ b/quickstep/AndroidManifest.xml @@ -73,14 +73,6 @@ </intent-filter> </provider> - <provider - android:name="com.android.quickstep.TestInformationProvider" - android:authorities="${packageName}.TestInfo" - android:readPermission="android.permission.WRITE_SECURE_SETTINGS" - android:writePermission="android.permission.WRITE_SECURE_SETTINGS" - android:exported="true"> - </provider> - <service android:name="com.android.launcher3.uioverrides.dynamicui.WallpaperManagerCompatVL$ColorExtractionService" tools:node="remove" /> diff --git a/quickstep/res/values/config.xml b/quickstep/res/values/config.xml index e84543b37..5c4d6d869 100644 --- a/quickstep/res/values/config.xml +++ b/quickstep/res/values/config.xml @@ -25,6 +25,8 @@ <string name="stats_log_manager_class" translatable="false">com.android.quickstep.logging.StatsLogCompatManager</string> + <string name="test_information_handler_class" translatable="false">com.android.quickstep.QuickstepTestInformationHandler</string> + <!-- The number of thumbnails and icons to keep in the cache. The thumbnail cache size also determines how many thumbnails will be fetched in the background. --> <integer name="recentsThumbnailCacheSize">3</integer> 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; - } -} |