Files
lawnchair/tests/src/com/android/launcher3/testcomponent/TestCommandProvider.java

132 lines
5.0 KiB
Java
Raw Normal View History

Merging ub-launcher3-master, build 5945220 Test: Manual Bug:123904290 P2 Remove magic constants from TAPL Bug:130294785 P3 Can no longer long press to open settings in hotseat area Bug:131115553 P2 Enable CacheDataUpdatedTaskTest tests Bug:134712476 P4 Add Duo contact to home screen, icon froze and vanished while over home screen Bug:136278866 P2 Temporary workarounds to make tests pass on Cuttlefish Bug:136829198 P2 Scrolling Overview During Quickswitch causes switch with weird animation Bug:137568159 P4 Refactor LauncherCallback to support multiple clients Bug:137777105 P1 Make clearcut launcher logging feature parity with westworld logging Bug:137851409 P4 Jank during swipe up due to inflation Bug:138620399 P1 Quick switch flicker / artifacts Bug:139016518 P2 [PinnedStackController] Move shelf offset into sysui Bug:139137636 P2 Create memory tests for Launcher Bug:139258979 P2 Switch to the screenshot mode when then system passes ThumbnailData back upon RecentsAnimation cancelation Bug:139259253 P2 Transform multiple app surfaces during app open animation from overview Bug:139439373 P2 Live tile should switch to screenshot before finishing recents animation Bug:139828243 P2 Create a prototype for Overview screenshot actions with a SystemUI plugin Bug:139888225 P2 Convert custom widget into plugins Bug:139913027 P2 [a11y] App title in Widget list shouldn't be actionable by a11y methods. (It would cause Pixel launcher crash.) Bug:139917483 P1 [B1C1][Dec19_QPR][CTS_Verifier_10_r1]Pixel launcher crash observed in Device owner test-> Lock Task UI Bug:139941530 P2 Lab-only Flake: Launcher switches to All Apps after pressing Recents button Bug:140212732 P2 [PO Cable] Strange launcher behavior after restore Bug:140242324 P2 Cache shortcutInfo icons in Launcher Bug:140246642 P4 Add binder tests for launcher interactions Bug:140311911 P2 Flake in Launcher tests: java.lang.AssertionError: Stable state != state: OverviewState, LauncherState Bug:140406263 P2 [a11y] Unable to scroll to the left of the main Home screen to Display google app by Voice access or Switch access. Bug:140539007 P3 After apply the wallpaper on wallpaper picker, the screen will stay on wallpaper picker about 2 second Bug:140626334 P4 Pass wallpaper SC to launcher for animation during launch and swipe up Bug:140635319 P1 [Flaky test] testPromiseIcon_addedFromEligibleSession failing due to NPE on Launcher#getStateManager Bug:140786694 P2 [A11y]No talkback feedback when long pressing on an app at home screen Bug:140935140 P1 Launcher force close observed while accessing app info shortcuts. Bug:141260670 P3 Drag and drop preview doesn't match the destination grid size Bug:141262820 P3 [Grid] icon badge size should scale as the grid size changes Bug:141265063 P2 Long press on homescreen in between icons doesn't bring up home settings Bug:141275518 P2 Test WellbeingTests.testPauseAppFromOverview flakes on Cuttlefish Bug:141315387 P1 [Failing test] 3P launchers + 2 button mode: failed goToOverviewFromHome and goToOverviewFromApp Bug:141376165 P2 Remove static initializations in Launcher Bug:141390432 P1 [Failing test] TaplTestsLauncher3 in 2-button mode Bug:141517004 P1 FallbackRecentsTest.goToOverviewFromHome Failure Bug:141522764 P1 DefaultLayoutProviderTest failures Bug:141523101 P1 TaplTestsQuickstep#testAllAppsFromHome,testAllAppsFromOverview failures Bug:141524555 P1 FallbackRecentsTest.testOverview flake Bug:141576561 P2 Fix FlagOverrideSampleTest inside robolectric test Bug:141576665 P2 AddWorkspaceItemsTaskTest broken Bug:141577881 P2 FileLogTest broken Bug:141579810 P1 ViewInflationDuringSwipeUp test failures Bug:141580748 P2 FallbackRecentsTest#testOverview failure Bug:141697444 P1 TaplTestsLauncher3#testWidgets test failure Bug:141770616 P2 Flake: Can't find a launcher object; selector: BySelector [RES='\Qcom.google.android.apps.nexuslauncher:id/deep_shortcuts_container\E'] (visible state: AllApps), Bug:141772190 P2 Flake: Context menu is still visible afterswiping up to home Bug:141864547 P2 calendar-stable sometimes fails dialog dismissal on cuttlefish Bug:141886704 P2 Use app targets to determine input consumer instead of launcher state Bug:141934188 P2 Automation Test for adding widget automatically Bug:141939911 P3 Clean up SwipeDetector Bug:141986013 P2 Update all apps fade interpolators Bug:142068081 P1 Quick Switch touch swipe dropped, flicker ensues Bug:142120338 P2 Gmail app (work profile) icon not drawing Bug:142148773 P2 grid size should not affect widget padding in WidgetsRecyclerView Bug:142351228 P1 public void testSwipeUp_with_list_widgets() is failing for merge CL Bug:79868152 P3 Fade out caret with workspace and back in when in Overview Bug:136282913 P1 Swipe up from Assistant Fulfillment Card Jank Bug:138473688 P4 Home settings can't be dismissed by swipe up Bug:140252765 P2 Audit Gesture Nav tests (including Back and Quick Switch) Bug:141568904 P1 NPE: Pixel launcher crash is observed when adding Directions widget Bug:142514365 P1 Failing test AddWidgetTest.testDragIcon Bug:142803200 P1 Broken binder tests Change-Id: I811537cc8d406f0acd9fa45daddae4da79ffff12
2019-10-16 06:03:42 +00:00
/*
* 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.launcher3.testcomponent;
import static android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_DISABLED;
import static android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_ENABLED;
import static android.content.pm.PackageManager.DONT_KILL_APP;
import static android.os.ParcelFileDescriptor.MODE_READ_WRITE;
import static com.android.launcher3.testcomponent.TestCommandReceiver.DISABLE_TEST_LAUNCHER;
import static com.android.launcher3.testcomponent.TestCommandReceiver.ENABLE_TEST_LAUNCHER;
import static com.android.launcher3.testcomponent.TestCommandReceiver.EXTRA_VALUE;
import static com.android.launcher3.testcomponent.TestCommandReceiver.GET_SYSTEM_HEALTH_MESSAGE;
import static com.android.launcher3.testcomponent.TestCommandReceiver.KILL_PROCESS;
import static com.android.launcher3.testcomponent.TestCommandReceiver.SET_LIST_VIEW_SERVICE_BINDER;
import android.app.Activity;
import android.app.ActivityManager;
import android.content.ComponentName;
import android.content.ContentProvider;
import android.content.ContentValues;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.os.ParcelFileDescriptor;
import android.util.Base64;
import com.android.launcher3.tapl.TestHelpers;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
public class TestCommandProvider extends ContentProvider {
@Override
public boolean onCreate() {
return true;
}
@Override
public int delete(Uri uri, String selection, String[] selectionArgs) {
throw new UnsupportedOperationException("unimplemented mock method");
}
@Override
public String getType(Uri uri) {
throw new UnsupportedOperationException("unimplemented mock method");
}
@Override
public Uri insert(Uri uri, ContentValues values) {
throw new UnsupportedOperationException("unimplemented mock method");
}
@Override
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs,
String sortOrder) {
throw new UnsupportedOperationException("unimplemented mock method");
}
@Override
public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
throw new UnsupportedOperationException("unimplemented mock method");
}
@Override
public Bundle call(String method, String arg, Bundle extras) {
switch (method) {
case ENABLE_TEST_LAUNCHER: {
getContext().getPackageManager().setComponentEnabledSetting(
new ComponentName(getContext(), TestLauncherActivity.class),
COMPONENT_ENABLED_STATE_ENABLED, DONT_KILL_APP);
return null;
}
case DISABLE_TEST_LAUNCHER: {
getContext().getPackageManager().setComponentEnabledSetting(
new ComponentName(getContext(), TestLauncherActivity.class),
COMPONENT_ENABLED_STATE_DISABLED, DONT_KILL_APP);
return null;
}
case KILL_PROCESS: {
((ActivityManager) getContext().getSystemService(Activity.ACTIVITY_SERVICE))
.killBackgroundProcesses(arg);
return null;
}
case GET_SYSTEM_HEALTH_MESSAGE: {
final Bundle response = new Bundle();
response.putString("result",
TestHelpers.getSystemHealthMessage(getContext(), Long.parseLong(arg)));
return response;
}
case SET_LIST_VIEW_SERVICE_BINDER: {
ListViewService.sBinderForTest = extras.getBinder(EXTRA_VALUE);
return null;
}
}
return super.call(method, arg, extras);
}
@Override
public ParcelFileDescriptor openFile(Uri uri, String mode) throws FileNotFoundException {
String path = Base64.encodeToString(uri.getPath().getBytes(),
Base64.NO_CLOSE | Base64.NO_PADDING | Base64.NO_WRAP);
File file = new File(getContext().getCacheDir(), path);
if (!file.exists()) {
// Create an empty file so that we can pass its descriptor
try {
file.createNewFile();
} catch (IOException e) {
}
}
return ParcelFileDescriptor.open(file, MODE_READ_WRITE);
}
}