mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-27 15:26:58 +00:00
adding popup test files and allow for selecting activity to use
Test: manual Bug: 289228540 Flag: N/A Change-Id: Ie78cd39d5636d8737b80a809fb22328de574f0c0
This commit is contained in:
@@ -299,6 +299,28 @@
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity-alias>
|
||||
<activity-alias android:name="MaxShortcutsActivity"
|
||||
android:label="TestActivityMaxShortcuts"
|
||||
android:exported="true"
|
||||
android:targetActivity="com.android.launcher3.testcomponent.OtherBaseTestingActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
</intent-filter>
|
||||
<meta-data android:name="android.app.shortcuts"
|
||||
android:resource="@xml/max_shortcuts"/>
|
||||
</activity-alias>
|
||||
<activity-alias android:name="SingleShortcutActivity"
|
||||
android:label="TestActivitySingleShortcut"
|
||||
android:exported="true"
|
||||
android:targetActivity="com.android.launcher3.testcomponent.OtherBaseTestingActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
</intent-filter>
|
||||
<meta-data android:name="android.app.shortcuts"
|
||||
android:resource="@xml/single_shortcut"/>
|
||||
</activity-alias>
|
||||
<activity
|
||||
android:name="com.android.launcher3.testcomponent.DialogTestActivity"
|
||||
android:label="Dialog Activity"
|
||||
|
||||
@@ -3,4 +3,5 @@
|
||||
<string name="shortcut1" translatable="false">Shortcut 1</string>
|
||||
<string name="shortcut2" translatable="false">Shortcut 2</string>
|
||||
<string name="shortcut3" translatable="false">Shortcut 3</string>
|
||||
<string name="shortcut4" translatable="false">Shortcut 4</string>
|
||||
</resources>
|
||||
|
||||
39
tests/res/xml/max_shortcuts.xml
Normal file
39
tests/res/xml/max_shortcuts.xml
Normal file
@@ -0,0 +1,39 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (C) 2023 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.
|
||||
-->
|
||||
<shortcuts xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
<shortcut
|
||||
android:shortcutId="max_shortcut1"
|
||||
android:icon="@drawable/test_theme_icon"
|
||||
android:shortcutShortLabel="@string/shortcut1">
|
||||
<intent android:action="com.android.launcher3.intent.action.test_shortcut_max"/>
|
||||
</shortcut>
|
||||
<shortcut
|
||||
android:shortcutId="max_shortcut2"
|
||||
android:shortcutShortLabel="@string/shortcut2">
|
||||
<intent android:action="com.android.launcher3.intent.action.test_shortcut_max"/>
|
||||
</shortcut>
|
||||
<shortcut
|
||||
android:shortcutId="max_shortcut3"
|
||||
android:shortcutShortLabel="@string/shortcut3">
|
||||
<intent android:action="com.android.launcher3.intent.action.test_shortcut_max"/>
|
||||
</shortcut>
|
||||
<shortcut
|
||||
android:shortcutId="max_shortcut4"
|
||||
android:shortcutShortLabel="@string/shortcut4">
|
||||
<intent android:action="com.android.launcher3.intent.action.test_shortcut_max"/>
|
||||
</shortcut>
|
||||
</shortcuts>
|
||||
@@ -1,4 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (C) 2023 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.
|
||||
-->
|
||||
<shortcuts xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
<shortcut
|
||||
android:shortcutId="shortcut1_themed"
|
||||
|
||||
24
tests/res/xml/single_shortcut.xml
Normal file
24
tests/res/xml/single_shortcut.xml
Normal file
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (C) 2023 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.
|
||||
-->
|
||||
<shortcuts xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
<shortcut
|
||||
android:shortcutId="single_shortcut_themed"
|
||||
android:icon="@drawable/test_theme_icon"
|
||||
android:shortcutShortLabel="@string/shortcut1">
|
||||
<intent android:action="com.android.launcher3.intent.action.test_shortcut_single"/>
|
||||
</shortcut>
|
||||
</shortcuts>
|
||||
@@ -16,6 +16,7 @@
|
||||
package com.android.launcher3.celllayout;
|
||||
|
||||
import static androidx.test.core.app.ApplicationProvider.getApplicationContext;
|
||||
import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation;
|
||||
|
||||
import static com.android.launcher3.ui.TestViewHelpers.findWidgetProvider;
|
||||
import static com.android.launcher3.util.WidgetUtils.createWidgetInfo;
|
||||
@@ -43,9 +44,9 @@ import java.util.stream.IntStream;
|
||||
public class TestWorkspaceBuilder {
|
||||
|
||||
private static final String TAG = "CellLayoutBoardBuilder";
|
||||
private static final ComponentName APP_COMPONENT_NAME = new ComponentName(
|
||||
private static final String TEST_ACTIVITY_PACKAGE_PREFIX = "com.android.launcher3.tests.";
|
||||
private ComponentName mAppComponentName = new ComponentName(
|
||||
"com.google.android.calculator", "com.android.calculator2.Calculator");
|
||||
|
||||
private UserHandle mMyUser;
|
||||
|
||||
private Context mContext;
|
||||
@@ -80,8 +81,20 @@ public class TestWorkspaceBuilder {
|
||||
}
|
||||
|
||||
private AppInfo getApp() {
|
||||
return new AppInfo(APP_COMPONENT_NAME, "test icon", mMyUser,
|
||||
AppInfo.makeLaunchIntent(APP_COMPONENT_NAME));
|
||||
return new AppInfo(mAppComponentName, "test icon", mMyUser,
|
||||
AppInfo.makeLaunchIntent(mAppComponentName));
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to set the app to use for the test workspace,
|
||||
* using activity-alias from AndroidManifest-common.
|
||||
* @param testAppName the android:name field of the test app activity-alias to use
|
||||
*/
|
||||
public void setTestAppActivityAlias(String testAppName) {
|
||||
this.mAppComponentName = new ComponentName(
|
||||
getInstrumentation().getContext().getPackageName(),
|
||||
TEST_ACTIVITY_PACKAGE_PREFIX + testAppName
|
||||
);
|
||||
}
|
||||
|
||||
private void addCorrespondingWidgetRect(CellLayoutBoard.WidgetRect widgetRect,
|
||||
|
||||
Reference in New Issue
Block a user