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:
Elijah 2026-10-25 12:08:46 -07:00
parent 2739b278cd
commit 6a08aa242c
24 changed files with 635 additions and 79 deletions

View file

@ -6,8 +6,8 @@ android {
applicationId 'tv.luma.launcher'
minSdk 26
targetSdk 34
versionCode 15
versionName '1.1.12'
versionCode 16
versionName '1.1.13'
}
compileOptions { sourceCompatibility JavaVersion.VERSION_1_8; targetCompatibility JavaVersion.VERSION_1_8 }
}

View file

@ -1,10 +1,11 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="tv.luma.launcher" android:versionCode="15" android:versionName="1.1.12">
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="tv.luma.launcher" android:versionCode="16" android:versionName="1.1.13">
<uses-sdk android:minSdkVersion="26" android:targetSdkVersion="34" />
<uses-feature android:name="android.software.leanback" android:required="true" />
<uses-feature android:name="android.hardware.touchscreen" android:required="false" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
<uses-permission android:name="android.permission.REQUEST_DELETE_PACKAGES" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<queries>

View file

@ -25,7 +25,8 @@ public final class MainActivity extends Activity {
private LinearLayout content, appsContainer, mediaContainer, hero, sectionHeading;
private PlexClient.Media plexFeatured;
private TextView clock, eyebrow, headline, description, openHint, appCount, settingsButton;
private ImageButton inputButton;
private ImageButton inputButton, networkButton;
private NetworkStatus networkStatus;
private TvInputs tvInputs;
private List<TvInputs.Source> inputSources = Collections.emptyList();
private volatile int inputGeneration;
@ -97,6 +98,7 @@ public final class MainActivity extends Activity {
getWindow().getDecorView().setSystemUiVisibility(5894);
getWindow().setNavigationBarColor(Ui.BG);
buildShell();
networkStatus = new NetworkStatus(this, networkButton, handler);
}
private int d(float n) {
@ -183,11 +185,25 @@ public final class MainActivity extends Activity {
LinearLayout.LayoutParams inputLp = new LinearLayout.LayoutParams(d(39), d(34));
inputLp.leftMargin = d(17);
header.addView(inputButton, inputLp);
networkButton = new ImageButton(this);
networkButton.setImageResource(R.drawable.ic_wifi_off);
networkButton.setImageTintList(Ui.textColors());
networkButton.setPadding(d(9), d(7), d(9), d(7));
networkButton.setFocusable(true);
networkButton.setContentDescription("Network status · Open network settings");
networkButton.setId(View.generateViewId());
Ui.glass(networkButton, 18);
networkButton.setOnClickListener(v -> openNetworkSettings());
LinearLayout.LayoutParams networkLp = new LinearLayout.LayoutParams(d(39), d(34));
networkLp.leftMargin = d(17);
header.addView(networkButton, networkLp);
settingsButton = chip("⚙", v -> showSettings());
settingsButton.setTextSize(19);
settingsButton.setContentDescription("Luma settings");
settingsButton.setId(View.generateViewId());
inputButton.setNextFocusRightId(settingsButton.getId());
inputButton.setNextFocusRightId(networkButton.getId());
networkButton.setNextFocusRightId(settingsButton.getId());
settingsButton.setNextFocusLeftId(networkButton.getId());
LinearLayout.LayoutParams settingsLp = new LinearLayout.LayoutParams(d(39), d(34));
settingsLp.leftMargin = d(17);
header.addView(settingsButton, settingsLp);
@ -243,10 +259,6 @@ public final class MainActivity extends Activity {
footer.setPadding(d(4), d(24), d(4), 0);
TextView all = chip("All apps", v -> showAllApps());
footer.addView(all, new LinearLayout.LayoutParams(d(95), d(35)));
TextView customize = chip("Personalize", v -> showSettings());
LinearLayout.LayoutParams customizeLp = new LinearLayout.LayoutParams(d(112), d(35));
customizeLp.leftMargin = d(10);
footer.addView(customize, customizeLp);
content.addView(footer, new LinearLayout.LayoutParams(-1, d(66)));
setContentView(root);
configureScene();
@ -331,6 +343,7 @@ public final class MainActivity extends Activity {
protected void onResume() {
super.onResume();
foreground = true;
networkStatus.start();
tvInputs.start(
() -> {
handler.removeCallbacks(refreshInputTask);
@ -367,6 +380,7 @@ public final class MainActivity extends Activity {
protected void onPause() {
super.onPause();
foreground = false;
networkStatus.stop();
tvInputs.stop();
handler.removeCallbacks(refreshInputTask);
inputGeneration++;
@ -504,6 +518,8 @@ public final class MainActivity extends Activity {
private void renderApps() {
iconGeneration++;
// Removing focused children can focus another tile; retain the requested app across rebuilds.
String requestedSelection = selected;
List<AppRepository.App> previous = new ArrayList<>(visibleApps);
Set<String> hidden = hidden();
List<String> order = savedOrder();
@ -602,14 +618,16 @@ public final class MainActivity extends Activity {
if (!tiles.isEmpty()) {
settingsButton.setNextFocusDownId(tiles.values().iterator().next().getId());
inputButton.setNextFocusDownId(tiles.values().iterator().next().getId());
networkButton.setNextFocusDownId(tiles.values().iterator().next().getId());
}
String restore =
tiles.containsKey(selected)
? selected
tiles.containsKey(requestedSelection)
? requestedSelection
: (visibleApps.isEmpty() ? "" : visibleApps.get(0).pkg);
AppTile target = tiles.get(restore);
if (target != null) {
target.requestFocus();
selected = restore;
updateHero(findApp(restore));
if (reuse) target.post(() -> keepFocusVisible(target));
}
@ -875,17 +893,35 @@ public final class MainActivity extends Activity {
handler.post(
() -> {
if (!foreground || ticket != inputGeneration) return;
inputSources = sources;
boolean available = !sources.isEmpty();
if (!available && inputButton.hasFocus()) settingsButton.requestFocus();
inputButton.setVisibility(available ? View.VISIBLE : View.GONE);
settingsButton.setNextFocusLeftId(available ? inputButton.getId() : View.NO_ID);
if (!tiles.isEmpty())
inputButton.setNextFocusDownId(tiles.values().iterator().next().getId());
applyInputSources(sources);
});
});
}
private void applyInputSources(List<TvInputs.Source> sources) {
inputSources = sources;
boolean available = !sources.isEmpty();
if (!available && inputButton.hasFocus()) networkButton.requestFocus();
inputButton.setVisibility(available ? View.VISIBLE : View.GONE);
networkButton.setNextFocusLeftId(available ? inputButton.getId() : View.NO_ID);
if (!tiles.isEmpty())
inputButton.setNextFocusDownId(tiles.values().iterator().next().getId());
}
private void openNetworkSettings() {
for (String action : new String[] {
Settings.ACTION_WIFI_SETTINGS, Settings.ACTION_WIRELESS_SETTINGS, Settings.ACTION_SETTINGS
}) {
try {
startActivity(new Intent(action));
return;
} catch (ActivityNotFoundException | SecurityException e) {
// Some TV platforms omit a particular settings activity; try the portable fallback.
}
}
toast("Network settings unavailable");
}
private void showInputs() {
if (inputSources.isEmpty()) return;
LinearLayout p = panel("TV inputs", "Choose an input");
@ -1508,6 +1544,20 @@ public final class MainActivity extends Activity {
renderApps();
dismiss();
});
if ((app.info.activityInfo.applicationInfo.flags
& android.content.pm.ApplicationInfo.FLAG_SYSTEM) == 0)
action(
p,
"Uninstall app",
"Android will ask you to confirm",
() -> {
dismiss();
try {
startActivity(new Intent(Intent.ACTION_DELETE, Uri.parse("package:" + app.pkg)));
} catch (ActivityNotFoundException | SecurityException e) {
toast("Uninstall unavailable · Use Android app info");
}
});
action(
p,
"Android app info",
@ -1531,6 +1581,8 @@ public final class MainActivity extends Activity {
moving = true;
updateFeaturedText();
selected = app.pkg;
AppTile tile = tiles.get(app.pkg);
if (tile != null) tile.requestFocus();
moveOriginal = new ArrayList<>();
for (AppRepository.App a : visibleApps) moveOriginal.add(a.pkg);
openHint.setText("↔ ↕ Move " + app.label + " · OK saves · Back cancels");
@ -1578,9 +1630,10 @@ public final class MainActivity extends Activity {
: key == KeyEvent.KEYCODE_DPAD_DOWN ? columns() : 0;
if (delta != 0 && index >= 0) {
int next = Math.max(0, Math.min(visibleApps.size() - 1, index + delta));
Collections.swap(visibleApps, index, next);
List<String> order = new ArrayList<>();
for (AppRepository.App a : visibleApps) order.add(a.pkg);
// Keep visibleApps in displayed order until renderApps compares it with the new order.
Collections.swap(order, index, next);
saveOrder(order);
renderApps();
openHint.setText(

View file

@ -0,0 +1,74 @@
package tv.luma.launcher;
import android.content.Context;
import android.content.res.ColorStateList;
import android.net.ConnectivityManager;
import android.net.Network;
import android.net.NetworkCapabilities;
import android.os.Handler;
import android.widget.ImageButton;
/** One foreground-only callback; no Wi-Fi scans, location access, or polling. */
final class NetworkStatus {
private final ConnectivityManager connectivity;
private final ImageButton button;
private final Handler handler;
private ConnectivityManager.NetworkCallback callback;
NetworkStatus(Context context, ImageButton button, Handler handler) {
connectivity = context.getSystemService(ConnectivityManager.class);
this.button = button;
this.handler = handler;
}
void start() {
if (callback != null || connectivity == null) return;
callback = new ConnectivityManager.NetworkCallback() {
@Override
public void onCapabilitiesChanged(Network network, NetworkCapabilities capabilities) {
if (callback == this) show(capabilities);
}
@Override
public void onLost(Network network) {
if (callback == this) show(null);
}
};
try {
// Initial snapshot covers resume; subsequent state comes directly from callback capabilities.
show(connectivity.getNetworkCapabilities(connectivity.getActiveNetwork()));
connectivity.registerDefaultNetworkCallback(callback, handler);
} catch (SecurityException | IllegalArgumentException e) {
callback = null;
show(null);
}
}
void stop() {
ConnectivityManager.NetworkCallback previous = callback;
callback = null;
if (previous != null) {
try {
connectivity.unregisterNetworkCallback(previous);
} catch (IllegalArgumentException e) {
// Already removed by the platform.
}
}
}
private void show(NetworkCapabilities capabilities) {
boolean connected = capabilities != null;
boolean ethernet = connected && capabilities.hasTransport(NetworkCapabilities.TRANSPORT_ETHERNET);
boolean wifi = connected && capabilities.hasTransport(NetworkCapabilities.TRANSPORT_WIFI);
boolean internet = connected && capabilities.hasCapability(NetworkCapabilities.NET_CAPABILITY_VALIDATED);
String status = !connected ? "Network disconnected"
: (wifi ? "Wi-Fi" : ethernet ? "Ethernet" : "Network")
+ (internet ? " connected" : " · No internet access");
button.setImageResource(!connected ? R.drawable.ic_wifi_off
: ethernet ? R.drawable.ic_ethernet : R.drawable.ic_wifi);
button.setImageTintList(internet ? Ui.textColors()
: ColorStateList.valueOf(connected ? Ui.GOLD : Ui.MUTED));
button.setContentDescription(status + " · Open network settings");
button.setTooltipText(status);
}
}

View file

@ -0,0 +1,3 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
<path android:fillColor="#FFFFFFFF" android:pathData="M3,5L21,5L21,17L16,17L16,21L8,21L8,17L3,17ZM5,7L5,15L10,15L10,19L14,19L14,15L19,15L19,7ZM7,8L9,8L9,12L7,12ZM11,8L13,8L13,12L11,12ZM15,8L17,8L17,12L15,12Z" />
</vector>

View file

@ -0,0 +1,3 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
<path android:fillColor="#FFFFFFFF" android:pathData="M12,21L15,18C13.34,16.34 10.66,16.34 9,18ZM6,15L8,17C10.21,14.79 13.79,14.79 16,17L18,15C14.69,11.69 9.31,11.69 6,15ZM2,11L4,13C8.42,8.58 15.58,8.58 20,13L22,11C16.48,5.48 7.52,5.48 2,11Z" />
</vector>

View file

@ -0,0 +1,3 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
<path android:fillColor="#FFFFFFFF" android:pathData="M2.3,1L1,2.3L5.2,6.5C3.7,7.2 2.3,8.2 1,9.5L3,11.5C4.3,10.2 5.8,9.2 7.3,8.6L9.5,10.8C7.8,11.2 6.2,12 5,13.3L7,15.3C8.4,13.9 10.3,13.3 12.1,13.5L14.5,15.9C12.8,15.2 10.8,15.5 9.5,16.8L12,19.3L14.7,16.6L21.7,23.6L23,22.3ZM12,5C16.1,5 19.9,6.6 23,9.5L21,11.5C18.5,9 15.3,7.8 12,7.8L9.2,5.1C10.1,5 11,5 12,5Z" />
</vector>