Release 1.1.13: fix app movement and add launcher actions
Keep the displayed app order intact until the grid reuse comparison, and retain selection during rebuilds so D-pad rearranging visibly moves the chosen tile. Add Android-confirmed uninstall for user apps and a foreground-only Wi-Fi/Ethernet shortcut with separate TV-input spacing. Remove the duplicate Personalize footer. Use an explicitly authorized replacement signing identity after loss of the original key. Document the one-time reinstall and preserve signature verification. Add a portable build using ignored signing configuration and regression checks for movement, lifecycle, native network settings, and cancel/confirm uninstall. Validated on the authorized onn 4K Plus: original failing move reproduction now passes, HomeActions/GridReuse/WakeRegression/Navigation instrumentation passes, and native settings/uninstall checks pass. Input-header availability was simulated; physical Ethernet and input switching were not exercised. Restore prior visible settings and Home override; remove the disposable test APK.
This commit is contained in:
parent
2739b278cd
commit
6a08aa242c
24 changed files with 635 additions and 79 deletions
|
|
@ -1,6 +1,11 @@
|
|||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="tv.luma.launcher.tests">
|
||||
<uses-sdk android:minSdkVersion="26" android:targetSdkVersion="34" />
|
||||
<application android:label="Luma wake regression tests" />
|
||||
<application android:label="Luma test app">
|
||||
<activity android:name=".UninstallFixtureActivity" android:exported="true">
|
||||
<intent-filter><action android:name="android.intent.action.MAIN" /><category android:name="android.intent.category.LEANBACK_LAUNCHER" /></intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
<instrumentation android:name="tv.luma.launcher.HomeActionsInstrumentation" android:targetPackage="tv.luma.launcher" android:functionalTest="true" />
|
||||
<instrumentation android:name=".WakeRegressionInstrumentation" android:targetPackage="tv.luma.launcher" android:functionalTest="true" />
|
||||
<instrumentation android:name="tv.luma.launcher.UpdaterInstrumentation" android:targetPackage="tv.luma.launcher" android:functionalTest="true" />
|
||||
<instrumentation android:name=".PerformanceInstrumentation" android:targetPackage="tv.luma.launcher" android:functionalTest="true" />
|
||||
|
|
|
|||
181
tests/device/HomeActionsInstrumentation.java
Normal file
181
tests/device/HomeActionsInstrumentation.java
Normal file
|
|
@ -0,0 +1,181 @@
|
|||
package tv.luma.launcher;
|
||||
|
||||
import android.app.*;
|
||||
import android.content.*;
|
||||
import android.graphics.Rect;
|
||||
import android.net.NetworkCapabilities;
|
||||
import android.os.Bundle;
|
||||
import android.view.*;
|
||||
import android.widget.TextView;
|
||||
import java.lang.reflect.*;
|
||||
import java.util.*;
|
||||
|
||||
/** Real menu/key dispatch regression, with layout/preferences restored in finally. */
|
||||
public final class HomeActionsInstrumentation extends Instrumentation {
|
||||
private Activity activity;
|
||||
|
||||
private Object get(Object target, String name) throws Exception {
|
||||
Field f = target.getClass().getDeclaredField(name);
|
||||
f.setAccessible(true);
|
||||
return f.get(target);
|
||||
}
|
||||
|
||||
private void call(Object target, String name, Class<?> type, Object arg) {
|
||||
runOnMainSync(() -> {
|
||||
try {
|
||||
Method m = type == null ? target.getClass().getDeclaredMethod(name)
|
||||
: target.getClass().getDeclaredMethod(name, type);
|
||||
m.setAccessible(true);
|
||||
if (type == null) m.invoke(target); else m.invoke(target, arg);
|
||||
} catch (Exception e) { throw new RuntimeException(e); }
|
||||
});
|
||||
waitForIdleSync();
|
||||
}
|
||||
|
||||
private List<String> order() throws Exception {
|
||||
return new ArrayList<>(((Map<String, ?>) get(activity, "tiles")).keySet());
|
||||
}
|
||||
|
||||
private void key(int key) {
|
||||
sendKeyDownUpSync(key);
|
||||
android.os.SystemClock.sleep(180);
|
||||
waitForIdleSync();
|
||||
}
|
||||
|
||||
private void check(boolean ok, String message) {
|
||||
if (!ok) throw new AssertionError(message);
|
||||
}
|
||||
|
||||
private TextView text(View v, String prefix) {
|
||||
if (v instanceof TextView && ((TextView) v).getText().toString().startsWith(prefix))
|
||||
return (TextView) v;
|
||||
if (v instanceof ViewGroup)
|
||||
for (int i = 0; i < ((ViewGroup) v).getChildCount(); i++) {
|
||||
TextView found = text(((ViewGroup) v).getChildAt(i), prefix);
|
||||
if (found != null) return found;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void begin(String pkg) throws Exception {
|
||||
// A preceding tap-based check may leave Android in touch mode. A remote arrow exits it.
|
||||
key(KeyEvent.KEYCODE_DPAD_UP);
|
||||
View tile = (View) ((Map<?, ?>) get(activity, "tiles")).get(pkg);
|
||||
runOnMainSync(() -> { tile.requestFocus(); tile.performLongClick(); });
|
||||
waitForIdleSync();
|
||||
Thread.sleep(350);
|
||||
Dialog dialog = (Dialog) get(activity, "currentDialog");
|
||||
TextView move = text(dialog.getWindow().getDecorView(), "Move in grid");
|
||||
check(move != null, "move menu missing");
|
||||
runOnMainSync(move::requestFocus);
|
||||
key(KeyEvent.KEYCODE_DPAD_CENTER);
|
||||
waitForIdleSync();
|
||||
check((boolean) get(activity, "moving"), "remote OK did not enter move mode");
|
||||
}
|
||||
|
||||
private void move(int key, List<String> expected, String pkg, int index) throws Exception {
|
||||
int old = expected.indexOf(pkg);
|
||||
Collections.swap(expected, old, index);
|
||||
key(key);
|
||||
waitForIdleSync();
|
||||
check(order().equals(expected), "visible order did not follow arrow " + key);
|
||||
check(pkg.equals(get(activity, "selected")), "moving selection lost");
|
||||
check(pkg.equals(activity.getCurrentFocus().getTag()), "focus left moving app");
|
||||
}
|
||||
|
||||
@Override public void onCreate(Bundle b) { super.onCreate(b); start(); }
|
||||
|
||||
@Override public void onStart() {
|
||||
Bundle result = new Bundle();
|
||||
StringBuilder report = new StringBuilder();
|
||||
int status = Activity.RESULT_OK;
|
||||
SharedPreferences prefs = getTargetContext().getSharedPreferences("luma", 0);
|
||||
boolean hadOrder = prefs.contains("order");
|
||||
String original = prefs.getString("order", "");
|
||||
try {
|
||||
activity = startActivitySync(new Intent(Intent.ACTION_MAIN)
|
||||
.setComponent(new ComponentName("tv.luma.launcher", "tv.luma.launcher.MainActivity"))
|
||||
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
|
||||
Thread.sleep(2000);
|
||||
List<String> initial = order(), expected = new ArrayList<>(initial);
|
||||
int columns = prefs.getInt("columns", 6);
|
||||
check(initial.size() > columns + 1, "not enough apps for vertical movement");
|
||||
String pkg = initial.get(0);
|
||||
begin(pkg);
|
||||
move(KeyEvent.KEYCODE_DPAD_RIGHT, expected, pkg, 1);
|
||||
move(KeyEvent.KEYCODE_DPAD_DOWN, expected, pkg, columns + 1);
|
||||
move(KeyEvent.KEYCODE_DPAD_UP, expected, pkg, 1);
|
||||
move(KeyEvent.KEYCODE_DPAD_LEFT, expected, pkg, 0);
|
||||
move(KeyEvent.KEYCODE_DPAD_LEFT, expected, pkg, 0);
|
||||
move(KeyEvent.KEYCODE_DPAD_UP, expected, pkg, 0);
|
||||
move(KeyEvent.KEYCODE_DPAD_RIGHT, expected, pkg, 1);
|
||||
key(KeyEvent.KEYCODE_BACK);
|
||||
check(order().equals(initial), "Back did not restore order");
|
||||
check(!(boolean) get(activity, "moving"), "Back did not exit move mode");
|
||||
report.append("PASS: remote menu entry, all four arrows, bounds, focus, Back cancellation\n");
|
||||
begin(pkg);
|
||||
expected = new ArrayList<>(initial);
|
||||
move(KeyEvent.KEYCODE_DPAD_DOWN, expected, pkg, columns);
|
||||
key(KeyEvent.KEYCODE_DPAD_CENTER);
|
||||
check(!(boolean) get(activity, "moving"), "OK did not save");
|
||||
runOnMainSync(() -> { callActivityOnPause(activity); callActivityOnStop(activity);
|
||||
callActivityOnStart(activity); callActivityOnResume(activity); });
|
||||
Thread.sleep(1200);
|
||||
check(order().equals(expected), "saved move lost on resume");
|
||||
report.append("PASS: OK saves order across stop/start\n");
|
||||
|
||||
View network = (View) get(activity, "networkButton");
|
||||
View input = (View) get(activity, "inputButton");
|
||||
View settings = (View) get(activity, "settingsButton");
|
||||
List<TvInputs.Source> actual = (List<TvInputs.Source>) get(activity, "inputSources");
|
||||
call(activity, "applyInputSources", List.class,
|
||||
Collections.singletonList(new TvInputs.Source("test", "Test input", "Connected")));
|
||||
Thread.sleep(250);
|
||||
Rect nr = new Rect(), ir = new Rect(), sr = new Rect();
|
||||
network.getGlobalVisibleRect(nr); input.getGlobalVisibleRect(ir); settings.getGlobalVisibleRect(sr);
|
||||
check(!ir.isEmpty() && !nr.isEmpty() && !sr.isEmpty(), "header buttons clipped");
|
||||
check(ir.right < nr.left && nr.right < sr.left, "header buttons overlap");
|
||||
runOnMainSync(input::requestFocus);
|
||||
key(KeyEvent.KEYCODE_DPAD_RIGHT);
|
||||
check(network.hasFocus(), "input to network focus failed");
|
||||
key(KeyEvent.KEYCODE_DPAD_RIGHT);
|
||||
check(settings.hasFocus(), "network to settings focus failed");
|
||||
key(KeyEvent.KEYCODE_DPAD_LEFT);
|
||||
check(network.hasFocus(), "settings to network focus failed");
|
||||
call(activity, "applyInputSources", List.class, Collections.emptyList());
|
||||
check(input.getVisibility() == View.GONE, "input not hidden without capability");
|
||||
call(activity, "applyInputSources", List.class, actual);
|
||||
report.append("PASS: simulated physical-input header has separate bounds and D-pad focus\n");
|
||||
Object monitor = get(activity, "networkStatus");
|
||||
call(monitor, "show", NetworkCapabilities.class, null);
|
||||
check(network.getContentDescription().toString().startsWith("Network disconnected"), "offline status");
|
||||
call(monitor, "stop", null, null);
|
||||
check(get(monitor, "callback") == null, "callback retained while stopped");
|
||||
call(monitor, "start", null, null);
|
||||
check(get(monitor, "callback") != null, "callback not restored");
|
||||
check(!network.getContentDescription().toString().startsWith("Network disconnected"),
|
||||
"live network did not recover after offline state");
|
||||
check(text(activity.getWindow().getDecorView(), "Personalize") == null, "duplicate footer remains");
|
||||
report.append("PASS: offline presentation, live-network recovery, callback stop/restart, footer\n");
|
||||
} catch (Throwable t) {
|
||||
status = Activity.RESULT_CANCELED;
|
||||
report.append("FAIL: ").append(t).append('\n');
|
||||
} finally {
|
||||
if (activity != null) {
|
||||
try {
|
||||
if ((boolean) get(activity, "moving")) key(KeyEvent.KEYCODE_BACK);
|
||||
} catch (Exception e) { status = Activity.RESULT_CANCELED; report.append("FAIL: move cleanup ").append(e); }
|
||||
}
|
||||
SharedPreferences.Editor edit = prefs.edit();
|
||||
if (hadOrder) edit.putString("order", original); else edit.remove("order");
|
||||
if (!edit.commit()) { status = Activity.RESULT_CANCELED; report.append("FAIL: order restore\n"); }
|
||||
if (activity != null) {
|
||||
try {
|
||||
call(activity, "renderApps", null, null);
|
||||
} catch (Exception e) { status = Activity.RESULT_CANCELED; report.append("FAIL: cleanup ").append(e); }
|
||||
}
|
||||
}
|
||||
result.putString("stream", report.toString());
|
||||
finish(status, result);
|
||||
}
|
||||
}
|
||||
4
tests/device/UninstallFixtureActivity.java
Normal file
4
tests/device/UninstallFixtureActivity.java
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
package tv.luma.launcher.tests;
|
||||
|
||||
/** Disposable app entry for exercising the real Android uninstall flow. */
|
||||
public final class UninstallFixtureActivity extends android.app.Activity {}
|
||||
Loading…
Add table
Add a link
Reference in a new issue