Add capability-based TV input button and switching
This commit is contained in:
parent
22a2130563
commit
5f035d909a
13 changed files with 374 additions and 11 deletions
|
|
@ -28,6 +28,12 @@ Projectivy's **Settings → General → Override current launcher** is switched
|
|||
|
||||
To return to the previous routing, turn off Luma's Home override, then open Projectivy and re-enable **Override current launcher**. No launcher needs to be disabled or uninstalled. The native chooser uses Android's [Home role API](https://developer.android.com/reference/android/app/role/RoleManager); the workaround uses the documented [AccessibilityService callbacks](https://developer.android.com/reference/android/accessibilityservice/AccessibilityService).
|
||||
|
||||
## TV inputs
|
||||
|
||||
On TVs exposing physical inputs through Android, an **input icon** appears beside Settings. Choose a port with the D-pad and press OK. Android's input names/custom labels and connection states are used; hidden inputs and duplicate CEC child entries are omitted. Devices exposing no physical inputs have no input button.
|
||||
|
||||
Luma opens an available standard TV channel viewer, with Android's native `TvView` as a fallback. Back from Luma's input viewer returns to Home. The viewer and audio focus are released when hidden. Input discovery runs off the UI thread; input-change callbacks are registered only while Home is foreground, with no polling, device-model checks, or new permissions.
|
||||
|
||||
## Appearance
|
||||
|
||||
**Settings → Appearance → Banner** offers:
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@ android {
|
|||
applicationId 'tv.luma.launcher'
|
||||
minSdk 26
|
||||
targetSdk 34
|
||||
versionCode 12
|
||||
versionName '1.1.9'
|
||||
versionCode 13
|
||||
versionName '1.1.10'
|
||||
}
|
||||
compileOptions { sourceCompatibility JavaVersion.VERSION_1_8; targetCompatibility JavaVersion.VERSION_1_8 }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="tv.luma.launcher" android:versionCode="12" android:versionName="1.1.9">
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="tv.luma.launcher" android:versionCode="13" android:versionName="1.1.10">
|
||||
<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" />
|
||||
|
|
@ -8,10 +8,12 @@
|
|||
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
|
||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
||||
<queries>
|
||||
<intent><action android:name="android.intent.action.VIEW" /><data android:scheme="content" android:host="android.media.tv" android:mimeType="vnd.android.cursor.item/channel" /></intent>
|
||||
<intent><action android:name="android.intent.action.MAIN" /><category android:name="android.intent.category.LEANBACK_LAUNCHER" /></intent>
|
||||
<intent><action android:name="android.intent.action.MAIN" /><category android:name="android.intent.category.LAUNCHER" /></intent>
|
||||
</queries>
|
||||
<application android:label="Luma" android:icon="@drawable/ic_luma" android:banner="@drawable/banner" android:theme="@style/AppTheme" android:allowBackup="false" android:supportsRtl="true" android:usesCleartextTraffic="true" android:hardwareAccelerated="true" android:largeHeap="false">
|
||||
<activity android:name=".InputActivity" android:exported="false" android:screenOrientation="landscape" android:configChanges="keyboard|keyboardHidden|navigation|orientation|screenSize" />
|
||||
<activity android:name=".MainActivity" android:exported="true" android:launchMode="singleTask" android:screenOrientation="landscape" android:configChanges="keyboard|keyboardHidden|navigation|orientation|screenSize" android:excludeFromRecents="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
|
|
|||
117
app/src/main/java/tv/luma/launcher/InputActivity.java
Normal file
117
app/src/main/java/tv/luma/launcher/InputActivity.java
Normal file
|
|
@ -0,0 +1,117 @@
|
|||
package tv.luma.launcher;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.media.*;
|
||||
import android.media.tv.*;
|
||||
import android.os.Bundle;
|
||||
import android.view.*;
|
||||
import android.widget.*;
|
||||
|
||||
/** Standard TV-input viewer for devices without an available native channel-view activity. */
|
||||
public final class InputActivity extends Activity {
|
||||
private TvView tv;
|
||||
private TextView status;
|
||||
private TvInputs.Source source;
|
||||
private AudioManager audio;
|
||||
private AudioFocusRequest focus;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle state) {
|
||||
super.onCreate(state);
|
||||
String id = getIntent().getStringExtra("inputId");
|
||||
for (TvInputs.Source item : new TvInputs(this).list()) if (item.id.equals(id)) source = item;
|
||||
if (source == null) {
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
setTitle(source.label);
|
||||
getWindow().getDecorView().setSystemUiVisibility(5894);
|
||||
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
FrameLayout root = new FrameLayout(this);
|
||||
root.setBackgroundColor(Color.BLACK);
|
||||
tv = new TvView(this);
|
||||
tv.setFocusable(true);
|
||||
tv.setFocusableInTouchMode(true);
|
||||
root.addView(tv, new FrameLayout.LayoutParams(-1, -1));
|
||||
status = Ui.text(this, "Switching to " + source.label + "…", 20, Ui.WHITE);
|
||||
status.setGravity(Gravity.CENTER);
|
||||
root.addView(status, new FrameLayout.LayoutParams(-1, -1));
|
||||
setContentView(root);
|
||||
tv.requestFocus();
|
||||
tv.setCallback(
|
||||
new TvView.TvInputCallback() {
|
||||
@Override
|
||||
public void onConnectionFailed(String id) {
|
||||
showStatus("Input unavailable · Press Back to return");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisconnected(String id) {
|
||||
showStatus("Input unavailable · Press Back to return");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onVideoAvailable(String id) {
|
||||
status.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onVideoUnavailable(String id, int reason) {
|
||||
if (reason != TvInputManager.VIDEO_UNAVAILABLE_REASON_TUNING
|
||||
&& reason != TvInputManager.VIDEO_UNAVAILABLE_REASON_BUFFERING)
|
||||
showStatus("No signal · Press Back to return");
|
||||
}
|
||||
});
|
||||
audio = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
|
||||
focus =
|
||||
new AudioFocusRequest.Builder(AudioManager.AUDIOFOCUS_GAIN)
|
||||
.setAudioAttributes(
|
||||
new AudioAttributes.Builder()
|
||||
.setUsage(AudioAttributes.USAGE_MEDIA)
|
||||
.setContentType(AudioAttributes.CONTENT_TYPE_MOVIE)
|
||||
.build())
|
||||
.setOnAudioFocusChangeListener(
|
||||
change -> {
|
||||
if (tv != null)
|
||||
tv.setStreamVolume(change == AudioManager.AUDIOFOCUS_GAIN ? 1 : 0);
|
||||
})
|
||||
.build();
|
||||
}
|
||||
|
||||
private void showStatus(String message) {
|
||||
status.setText(source.label + "\n" + message);
|
||||
status.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
if (tv == null) return;
|
||||
try {
|
||||
showStatus("Switching input…");
|
||||
int granted = audio.requestAudioFocus(focus);
|
||||
tv.setStreamVolume(granted == AudioManager.AUDIOFOCUS_REQUEST_GRANTED ? 1 : 0);
|
||||
tv.tune(source.id, TvContract.buildChannelUriForPassthroughInput(source.id));
|
||||
} catch (RuntimeException e) {
|
||||
showStatus("Input unavailable · Press Back to return");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
if (tv != null) tv.reset();
|
||||
if (audio != null && focus != null) audio.abandonAudioFocusRequest(focus);
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean dispatchKeyEvent(KeyEvent event) {
|
||||
if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) {
|
||||
if (event.getAction() == KeyEvent.ACTION_UP) finish();
|
||||
return true;
|
||||
}
|
||||
return super.dispatchKeyEvent(event);
|
||||
}
|
||||
}
|
||||
|
|
@ -25,6 +25,11 @@ 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 TvInputs tvInputs;
|
||||
private List<TvInputs.Source> inputSources = Collections.emptyList();
|
||||
private volatile int inputGeneration;
|
||||
private final Runnable refreshInputTask = this::refreshInputs;
|
||||
private final List<AppRepository.App> allApps = new ArrayList<>(),
|
||||
visibleApps = new ArrayList<>();
|
||||
private final Map<String, AppTile> tiles = new LinkedHashMap<>();
|
||||
|
|
@ -80,6 +85,7 @@ public final class MainActivity extends Activity {
|
|||
network.allowCoreThreadTimeOut(true);
|
||||
prefs = getSharedPreferences("luma", MODE_PRIVATE);
|
||||
repository = new AppRepository(this);
|
||||
tvInputs = new TvInputs(this);
|
||||
plex = new PlexClient(this);
|
||||
saverMedia = new SaverMedia(this);
|
||||
updater = new Updater(this);
|
||||
|
|
@ -161,10 +167,24 @@ public final class MainActivity extends Activity {
|
|||
clock = Ui.text(this, "", 13, Ui.WHITE);
|
||||
clock.setGravity(Gravity.RIGHT | Gravity.CENTER_VERTICAL);
|
||||
header.addView(clock, new LinearLayout.LayoutParams(d(125), d(32)));
|
||||
inputButton = new ImageButton(this);
|
||||
inputButton.setImageResource(R.drawable.ic_input);
|
||||
inputButton.setImageTintList(Ui.textColors());
|
||||
inputButton.setPadding(d(9), d(7), d(9), d(7));
|
||||
inputButton.setFocusable(true);
|
||||
inputButton.setContentDescription("TV inputs");
|
||||
inputButton.setId(View.generateViewId());
|
||||
Ui.glass(inputButton, 18);
|
||||
inputButton.setVisibility(View.GONE);
|
||||
inputButton.setOnClickListener(v -> showInputs());
|
||||
LinearLayout.LayoutParams inputLp = new LinearLayout.LayoutParams(d(39), d(34));
|
||||
inputLp.leftMargin = d(17);
|
||||
header.addView(inputButton, inputLp);
|
||||
settingsButton = chip("⚙", v -> showSettings());
|
||||
settingsButton.setTextSize(19);
|
||||
settingsButton.setContentDescription("Luma settings");
|
||||
settingsButton.setId(View.generateViewId());
|
||||
inputButton.setNextFocusRightId(settingsButton.getId());
|
||||
LinearLayout.LayoutParams settingsLp = new LinearLayout.LayoutParams(d(39), d(34));
|
||||
settingsLp.leftMargin = d(17);
|
||||
header.addView(settingsButton, settingsLp);
|
||||
|
|
@ -308,6 +328,13 @@ public final class MainActivity extends Activity {
|
|||
protected void onResume() {
|
||||
super.onResume();
|
||||
foreground = true;
|
||||
tvInputs.start(
|
||||
() -> {
|
||||
handler.removeCallbacks(refreshInputTask);
|
||||
handler.postDelayed(refreshInputTask, 100);
|
||||
},
|
||||
handler);
|
||||
refreshInputs();
|
||||
scene.resume();
|
||||
plex.resume();
|
||||
restoreImages();
|
||||
|
|
@ -337,6 +364,9 @@ public final class MainActivity extends Activity {
|
|||
protected void onPause() {
|
||||
super.onPause();
|
||||
foreground = false;
|
||||
tvInputs.stop();
|
||||
handler.removeCallbacks(refreshInputTask);
|
||||
inputGeneration++;
|
||||
generation++;
|
||||
artGeneration++;
|
||||
work.getQueue().clear();
|
||||
|
|
@ -544,8 +574,10 @@ public final class MainActivity extends Activity {
|
|||
appsContainer.addView(empty, new LinearLayout.LayoutParams(-1, d(70)));
|
||||
}
|
||||
appCount.setText(visibleApps.size() + " installed");
|
||||
if (!tiles.isEmpty())
|
||||
if (!tiles.isEmpty()) {
|
||||
settingsButton.setNextFocusDownId(tiles.values().iterator().next().getId());
|
||||
inputButton.setNextFocusDownId(tiles.values().iterator().next().getId());
|
||||
}
|
||||
String restore =
|
||||
tiles.containsKey(selected)
|
||||
? selected
|
||||
|
|
@ -841,6 +873,51 @@ public final class MainActivity extends Activity {
|
|||
updateButton.setVisibility(updater.available() == null ? View.GONE : View.VISIBLE);
|
||||
}
|
||||
|
||||
private void refreshInputs() {
|
||||
if (!foreground) return;
|
||||
final int ticket = ++inputGeneration;
|
||||
work.execute(
|
||||
() -> {
|
||||
if (!foreground || ticket != inputGeneration) return;
|
||||
List<TvInputs.Source> sources = tvInputs.list();
|
||||
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());
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
private void showInputs() {
|
||||
if (inputSources.isEmpty()) return;
|
||||
LinearLayout p = panel("TV inputs", "Choose an input");
|
||||
for (TvInputs.Source source : inputSources)
|
||||
action(
|
||||
p,
|
||||
source.label,
|
||||
source.state,
|
||||
() -> {
|
||||
dismiss();
|
||||
Intent nativeViewer = tvInputs.nativeIntent(source);
|
||||
if (nativeViewer != null) {
|
||||
try {
|
||||
startActivity(nativeViewer);
|
||||
return;
|
||||
} catch (RuntimeException e) {
|
||||
/* Try TvView. */
|
||||
}
|
||||
}
|
||||
startActivity(new Intent(this, InputActivity.class).putExtra("inputId", source.id));
|
||||
});
|
||||
action(p, "Cancel", null, this::dismiss);
|
||||
}
|
||||
|
||||
private void updatesSettings() {
|
||||
Updater.Release release = updater.available();
|
||||
long checked = updater.prefs.getLong("success", 0);
|
||||
|
|
|
|||
137
app/src/main/java/tv/luma/launcher/TvInputs.java
Normal file
137
app/src/main/java/tv/luma/launcher/TvInputs.java
Normal file
|
|
@ -0,0 +1,137 @@
|
|||
package tv.luma.launcher;
|
||||
|
||||
import android.content.*;
|
||||
import android.content.pm.*;
|
||||
import android.media.tv.*;
|
||||
import android.os.Handler;
|
||||
import java.util.*;
|
||||
|
||||
/** Physical input capabilities supplied by Android, independent of the device vendor. */
|
||||
final class TvInputs {
|
||||
static final class Source {
|
||||
final String id, label, state;
|
||||
|
||||
Source(String id, String label, String state) {
|
||||
this.id = id;
|
||||
this.label = label;
|
||||
this.state = state;
|
||||
}
|
||||
}
|
||||
|
||||
private final Context context;
|
||||
private final TvInputManager manager;
|
||||
private TvInputManager.TvInputCallback callback;
|
||||
|
||||
TvInputs(Context context) {
|
||||
this.context = context.getApplicationContext();
|
||||
manager = (TvInputManager) this.context.getSystemService(Context.TV_INPUT_SERVICE);
|
||||
}
|
||||
|
||||
List<Source> list() {
|
||||
List<Source> result = new ArrayList<>();
|
||||
if (manager == null) return result;
|
||||
try {
|
||||
List<TvInputInfo> inputs = manager.getTvInputList();
|
||||
Set<String> parents = new HashSet<>();
|
||||
for (TvInputInfo input : inputs)
|
||||
if (physical(input) && !input.isHidden(context)) parents.add(input.getId());
|
||||
for (TvInputInfo input : inputs) {
|
||||
if (!parents.contains(input.getId()) || parents.contains(input.getParentId())) continue;
|
||||
CharSequence label = input.loadCustomLabel(context);
|
||||
if (label == null || label.length() == 0) label = input.loadLabel(context);
|
||||
if (label == null || label.length() == 0) continue;
|
||||
int state = manager.getInputState(input.getId());
|
||||
result.add(
|
||||
new Source(
|
||||
input.getId(),
|
||||
label.toString(),
|
||||
state == TvInputManager.INPUT_STATE_DISCONNECTED
|
||||
? "No signal"
|
||||
: state == TvInputManager.INPUT_STATE_CONNECTED_STANDBY
|
||||
? "Standby"
|
||||
: "Connected"));
|
||||
}
|
||||
result.sort((a, b) -> a.label.compareToIgnoreCase(b.label));
|
||||
} catch (RuntimeException e) {
|
||||
// Some Android TV implementations do not expose inputs to third-party apps.
|
||||
result.clear();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private static boolean physical(TvInputInfo input) {
|
||||
return input.isPassthroughInput()
|
||||
&& input.getType() != TvInputInfo.TYPE_OTHER
|
||||
&& input.getType() != TvInputInfo.TYPE_TUNER;
|
||||
}
|
||||
|
||||
Intent nativeIntent(Source source) {
|
||||
Intent intent =
|
||||
new Intent(Intent.ACTION_VIEW)
|
||||
.setDataAndType(
|
||||
TvContract.buildChannelUriForPassthroughInput(source.id),
|
||||
TvContract.Channels.CONTENT_ITEM_TYPE);
|
||||
PackageManager pm = context.getPackageManager();
|
||||
try {
|
||||
for (ResolveInfo match :
|
||||
pm.queryIntentActivities(
|
||||
intent, PackageManager.MATCH_DEFAULT_ONLY | PackageManager.GET_RESOLVED_FILTER)) {
|
||||
ActivityInfo activity = match.activityInfo;
|
||||
// Exclude generic content browsers; only use an actual TV channel viewer.
|
||||
if (match.filter == null
|
||||
|| !match.filter.hasDataType(TvContract.Channels.CONTENT_ITEM_TYPE)
|
||||
|| !activity.exported
|
||||
|| !activity.enabled) continue;
|
||||
if (activity.permission != null
|
||||
&& pm.checkPermission(activity.permission, context.getPackageName())
|
||||
!= PackageManager.PERMISSION_GRANTED) continue;
|
||||
return intent.setComponent(new ComponentName(activity.packageName, activity.name));
|
||||
}
|
||||
} catch (RuntimeException e) {
|
||||
/* Use the platform TvView fallback. */
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
void start(Runnable changed, Handler handler) {
|
||||
if (manager == null || callback != null) return;
|
||||
TvInputManager.TvInputCallback listener =
|
||||
new TvInputManager.TvInputCallback() {
|
||||
@Override
|
||||
public void onInputAdded(String id) {
|
||||
changed.run();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInputRemoved(String id) {
|
||||
changed.run();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInputUpdated(String id) {
|
||||
changed.run();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInputStateChanged(String id, int state) {
|
||||
changed.run();
|
||||
}
|
||||
};
|
||||
try {
|
||||
manager.registerCallback(listener, handler);
|
||||
callback = listener;
|
||||
} catch (RuntimeException e) {
|
||||
/* Initial discovery can still be used. */
|
||||
}
|
||||
}
|
||||
|
||||
void stop() {
|
||||
if (callback == null) return;
|
||||
try {
|
||||
manager.unregisterCallback(callback);
|
||||
} catch (RuntimeException e) {
|
||||
/* Already gone. */
|
||||
}
|
||||
callback = null;
|
||||
}
|
||||
}
|
||||
4
app/src/main/res/drawable/ic_input.xml
Normal file
4
app/src/main/res/drawable/ic_input.xml
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
<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="M19,3H5C3.9,3 3,3.9 3,5V8H5V5H19V19H5V16H3V19C3,20.1 3.9,21 5,21H19C20.1,21 21,20.1 21,19V5C21,3.9 20.1,3 19,3ZM11,7L9.6,8.4L12.2,11H2V13H12.2L9.6,15.6L11,17L16,12Z" />
|
||||
</vector>
|
||||
|
|
@ -1 +1 @@
|
|||
Reduces unnecessary cinematic background work while moving quickly through apps. App focus feedback stays immediate; the background follows the final selected color after a short pause. Preserves smooth scrolling, artwork, and wake recovery. Tested on both the integrated TV and onn, with the same behavior across devices.
|
||||
Adds a TV-input button beside Settings on devices that expose physical inputs. Choose an HDMI or other supported input with the remote. The button stays hidden on streamers without inputs. Detects Android capabilities automatically, with no device-specific configuration.
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ No launcher application was disabled or uninstalled. Screensaver selection at th
|
|||
|
||||
Build validation uses aapt2, javac, D8, zipalign, and apksigner signature verification. There are no third-party runtime libraries.
|
||||
|
||||
Final APK (1.1.9): 2,753,622 bytes. SHA-256: `bf03db00b66fd1aa2eaf6ed6c6b65da222a32725e9549133e37890a758fd27df`.
|
||||
Final APK (1.1.10): 2,761,885 bytes. SHA-256: `d0bdcb6cecc43ecd6652d9c3da6b704f6f4586f07c2273e8694f31b6a96e0f9a`.
|
||||
|
||||
## Updater regression — October 18, 2026
|
||||
|
||||
|
|
@ -162,3 +162,21 @@ The new scheduling regression passed on both devices in both rendering modes. Th
|
|||
|
||||
|
||||
The final signed 1.1.9 build was installed on both devices. Screenshots confirm the wallpaper, app banners, focus appearance, and original layout. After settling with Android settings foreground, both launcher UIs and the onn Home helper consumed zero CPU ticks over five seconds. Home/Back returned/stayed in Luma on the onn; the TV retained its original disabled Home override. The onn's original accessibility list was restored after instrumentation, including Button Mapper. Both diagnostic APKs and the round's temporary on-device reports/scripts were removed; Projectivy remains installed and enabled on both devices. Both devices were returned to Luma.
|
||||
|
||||
|
||||
## Capability-based TV input button — October 19, 2026
|
||||
|
||||
Version 1.1.10 adds a focusable input icon immediately left of Settings. It is shown only when Android's TvInputManager exposes visible physical passthrough inputs. The code uses public input types/metadata, custom labels, hidden-input settings, and connection states; it contains no model/manufacturer/IP checks. CEC children whose physical parent is already listed are omitted. Tuners and virtual/app-only inputs do not create the button. Discovery runs on the existing worker, and input-change events are coalesced. The listener and pending refresh callback are removed on pause; stale results are discarded. No new Android permissions are requested.
|
||||
|
||||
On the onn, the system exposed no physical input entries and UIAutomator confirmed the header contains Settings with no input button. The existing header spacing remains intact. On the integrated TV, UIAutomator and screenshots confirmed the input icon, focus colors, D-pad Up to Settings then Left to inputs, and a picker with HDMI 1–4 plus Cancel. The connected CEC device is not duplicated as a fifth port.
|
||||
|
||||
The implementation discovers an exported/accessible standard channel-view handler through its MIME filter, excluding generic content browsers. Where no such handler is available, a private input activity uses Android's TvView and the selected passthrough URI. The TV did not expose a native channel-view activity to the active user during testing, so the TvView fallback was exercised without enabling/reinstalling any system app. The viewer requests media audio focus while visible, resets its input session and abandons audio focus on pause, and returns to Luma on Back.
|
||||
|
||||
Selecting HDMI 1 created a real TV-input session for Luma's UID with the expected physical input ID. The video-available callback hid the loading text. Selecting HDMI 2 created the corresponding port session and displayed “No signal · Press Back to return.” HDMI 1 was then selected again; its video-available callback fired, and Back returned to the launcher with artwork restored. TV-input dumps after returning confirmed Luma's session was released. The pre-existing provider session was retained. Live HDMI pixels were not available in the ADB screen capture; verification used input session IDs, video callback state, and the UI hierarchy. Audio was not listened to remotely.
|
||||
|
||||
The enhanced wake regression passed on both devices, including interrupted-load recovery, pause-only image reuse, partial-grid recovery, memory trimming, screensaver dismissal, nonblank bounded backgrounds, five stop/start cycles, and an assertion that the TV-input listener is removed when paused. This change makes no rendering-performance claim and does not change image resolution or the app grid layout.
|
||||
|
||||
The platform interfaces are documented in [TvInputManager](https://developer.android.com/reference/android/media/tv/TvInputManager), [TvInputInfo](https://developer.android.com/reference/android/media/tv/TvInputInfo), and [TvView](https://developer.android.com/reference/android/media/tv/TvView).
|
||||
|
||||
|
||||
Final 1.1.10 package/version checks passed on both devices, with the input button visible only on the TV. After settling with Android settings foreground, both UIs and the onn Home helper consumed zero CPU ticks over five seconds. The diagnostic APKs and temporary on-device files were removed. The onn's original Home/accessibility service list was restored after instrumentation; Home returned from Android settings, and Back stayed in Luma. The TV's existing Home override remains off. Projectivy remains installed/enabled on both devices, and both devices were returned to Luma. Raw local checks are in ignored `output/performance/input-switching/`.
|
||||
|
|
|
|||
BIN
output/Luma.apk
BIN
output/Luma.apk
Binary file not shown.
Binary file not shown.
|
|
@ -1,11 +1,11 @@
|
|||
{
|
||||
"schema": 1,
|
||||
"packageName": "tv.luma.launcher",
|
||||
"versionCode": 12,
|
||||
"versionName": "1.1.9",
|
||||
"versionCode": 13,
|
||||
"versionName": "1.1.10",
|
||||
"minSdk": 26,
|
||||
"apk": "Luma.apk",
|
||||
"size": 2753622,
|
||||
"sha256": "bf03db00b66fd1aa2eaf6ed6c6b65da222a32725e9549133e37890a758fd27df",
|
||||
"notes": "Reduces unnecessary cinematic background work while moving quickly through apps. App focus feedback stays immediate; the background follows the final selected color after a short pause. Preserves smooth scrolling, artwork, and wake recovery. Tested on both the integrated TV and onn, with the same behavior across devices."
|
||||
"size": 2761885,
|
||||
"sha256": "d0bdcb6cecc43ecd6652d9c3da6b704f6f4586f07c2273e8694f31b6a96e0f9a",
|
||||
"notes": "Adds a TV-input button beside Settings on devices that expose physical inputs. Choose an HDMI or other supported input with the remote. The button stays hidden on streamers without inputs. Detects Android capabilities automatically, with no device-specific configuration."
|
||||
}
|
||||
|
|
|
|||
|
|
@ -210,6 +210,8 @@ public final class WakeRegressionInstrumentation extends Instrumentation {
|
|||
throw new AssertionError("focus shadow still animating after stop");
|
||||
}
|
||||
Object scene = field(activity, "scene");
|
||||
if (field(field(activity, "tvInputs"), "callback") != null)
|
||||
throw new AssertionError("TV-input listener retained after pause");
|
||||
for (String name :
|
||||
new String[] {
|
||||
"wallpaper", "mediaArt", "frame", "previousFrame", "mask", "previousMask"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue