Debloat any Android or Google TV over Wi-Fi and get an Apple TV-style home.
Python adbadblockandroid-tvandroid-tv-launcherapple-tvbloatware-removalclaude-codedebloatfire-tvgoogle-tvlauncherprivacysmart-tvsony-braviatclvibe-codingxiaomi
launcher: draw the focus highlight on the GPU
occcatda15a448a4a4
diff --git a/launcher/app/src/main/java/com/gathin/tvhome/AppAdapter.java b/launcher/app/src/main/java/com/gathin/tvhome/AppAdapter.javaindex 489e74250..5a5ff1dc0 100644--- a/launcher/app/src/main/java/com/gathin/tvhome/AppAdapter.java+++ b/launcher/app/src/main/java/com/gathin/tvhome/AppAdapter.java@@ -368,10 +368,13 @@ public class AppAdapter extends RecyclerView.Adapter<AppAdapter.Holder> {card.setOnFocusChangeListener((view, focused) -> {float s = focused ? FOCUS_SCALE : 1.0f;+ view.animate().cancel();view.animate().scaleX(s).scaleY(s).setDuration(focused ? 260 : 180).setInterpolator(new OvershootInterpolator(focused ? 1.6f : 0f))+ .withLayer().start();+ name.animate().cancel();name.animate().alpha(focused ? 1f : 0f).translationY(focused ? density * 4f : -density * 6f).setDuration(220).start();diff --git a/launcher/app/src/main/java/com/gathin/tvhome/GlassView.java b/launcher/app/src/main/java/com/gathin/tvhome/GlassView.javaindex fcd85378a..82889b9e7 100644--- a/launcher/app/src/main/java/com/gathin/tvhome/GlassView.java+++ b/launcher/app/src/main/java/com/gathin/tvhome/GlassView.java@@ -4,7 +4,6 @@ import android.content.Context;import android.graphics.Canvas;import android.graphics.LinearGradient;import android.graphics.Paint;-import android.graphics.Path;import android.graphics.RectF;import android.graphics.Shader;import android.util.AttributeSet;@@ -21,7 +20,6 @@ public class GlassView extends View {private final Paint rim = new Paint(Paint.ANTI_ALIAS_FLAG);private final Paint glow = new Paint(Paint.ANTI_ALIAS_FLAG);private final RectF rect = new RectF();- private final Path clip = new Path();private final float density;private float radius;@@ -33,6 +31,12 @@ public class GlassView extends View {rim.setStrokeWidth(1.5f * density);rim.setColor(0xCCFFFFFF);glow.setStyle(Paint.Style.STROKE);+ glow.setStrokeWidth(2f * density);+ glow.setColor(0x22FFFFFF);+ // Cache the slab as a texture. The spring only changes translation, so the GPU can+ // move it without replaying clipPath and the glow on every frame. That path is+ // software-rendered on the MT5895 and is what makes the highlight crawl.+ setLayerType(LAYER_TYPE_HARDWARE, null);}void setRadius(float px) {@@ -52,22 +56,18 @@ public class GlassView extends View {float inset = 6f * density; // room for the glowrect.set(inset, inset, getWidth() - inset, getHeight() - inset);- // Outer glow: three widening, fading strokes.- for (int i = 1; i <= 3; i++) {- glow.setStrokeWidth(i * 2f * density);- glow.setColor((0x30 / i) << 24 | 0xFFFFFF);- float o = i * density;- canvas.drawRoundRect(rect.left - o, rect.top - o, rect.right + o, rect.bottom + o, radius + o, radius + o, glow);- }+ // One faint stroke: the layer caches it, so it is drawn once rather than on every+ // frame of the spring.+ float o = density;+ canvas.drawRoundRect(rect.left - o, rect.top - o, rect.right + o, rect.bottom + o,+ radius + o, radius + o, glow);canvas.drawRoundRect(rect, radius, radius, fill);- clip.reset();- clip.addRoundRect(rect, radius, radius, Path.Direction.CW);- canvas.save();- canvas.clipPath(clip);- canvas.drawRect(rect.left, rect.top, rect.right, rect.top + rect.height() * 0.45f, specular);- canvas.restore();+ // A sheen across the top, drawn as its own round rect so the highlight stays on the GPU.+ // clipPath falls back to software on this SoC and redraws for the whole spring.+ float sheenBottom = rect.top + rect.height() * 0.42f;+ canvas.drawRoundRect(rect.left, rect.top, rect.right, sheenBottom, radius, radius, specular);canvas.drawRoundRect(rect, radius, radius, rim);}diff --git a/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java b/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.javaindex e91721b0d..4d9a20f1d 100644--- a/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java+++ b/launcher/app/src/main/java/com/gathin/tvhome/MainActivity.java@@ -9,10 +9,15 @@ import android.content.Context;import android.content.Intent;import android.content.IntentFilter;import android.content.pm.ApplicationInfo;+import android.graphics.Bitmap;+import android.graphics.Canvas;import android.graphics.Color;+import android.graphics.Paint;+import android.graphics.RadialGradient;import android.graphics.Rect;+import android.graphics.Shader;+import android.graphics.drawable.BitmapDrawable;import android.graphics.drawable.ColorDrawable;-import android.graphics.drawable.GradientDrawable;import android.media.tv.TvContract;import android.media.tv.TvInputInfo;import android.media.tv.TvInputManager;@@ -83,8 +88,7 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {private GlassView glass;private View ambient;private TextView heroName;- private GradientDrawable ambientGlow;- private int ambientColor;+ private int ambientColor = -1;private boolean heroShown;private TextView greeting;private View btnInputs;@@ -193,12 +197,6 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {glass = findViewById(R.id.glass);ambient = findViewById(R.id.ambient);heroName = findViewById(R.id.heroName);- ambientGlow = new GradientDrawable();- ambientGlow.setGradientType(GradientDrawable.RADIAL_GRADIENT);- ambientGlow.setGradientCenter(0.32f, 0.42f);- ambient.setBackground(ambientGlow);- ambient.addOnLayoutChangeListener((v, l, t, r, b, ol, ot, or, ob) ->- ambientGlow.setGradientRadius((r - l) * 0.62f));greeting = findViewById(R.id.greeting);btnWifi = findViewById(R.id.btnWifi);shamsiDate = findViewById(R.id.shamsiDate);@@ -543,10 +541,30 @@ public class MainActivity extends Activity implements AppAdapter.TileListener {}}+ /**+ * The glow used to be a full-screen radial GradientDrawable. On Android 10 that drawable is+ * drawn on the CPU, so fading it for half a second redrew 1920×1080 every frame and the+ * highlight looked like it was running at a few frames per second. A small bitmap stretched+ * over the screen is one texture; changing apps only uploads it once.+ */private void setAmbient(int color) {+ if (color == ambientColor && ambient.getBackground() != null) return;ambientColor = color;int c = color & 0x00FFFFFF;- ambientGlow.setColors(new int[]{0x5C000000 | c, 0x26000000 | c, 0x00000000 | c});+ int w = 480;+ int h = 270;+ Bitmap bmp = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888);+ Canvas canvas = new Canvas(bmp);+ Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);+ paint.setShader(new RadialGradient(+ w * 0.32f, h * 0.42f, w * 0.62f,+ new int[]{0x5C000000 | c, 0x26000000 | c, 0x00000000 | c},+ new float[]{0f, 0.45f, 1f},+ Shader.TileMode.CLAMP));+ canvas.drawRect(0, 0, w, h, paint);+ BitmapDrawable drawable = new BitmapDrawable(getResources(), bmp);+ drawable.setGravity(Gravity.FILL);+ ambient.setBackground(drawable);}private void hideHero() {