Skip to content

Debloat any Android or Google TV over Wi-Fi and get an Apple TV-style home.

addons: Bluetooth Toggle, a one-press Bluetooth switch as a module card

Justin Newman9988ab354260
diff --git a/addons/bluetooth-toggle/.gitignore b/addons/bluetooth-toggle/.gitignore
new file mode 100644
index 000000000..a7e04a21b
--- /dev/null
+++ b/addons/bluetooth-toggle/.gitignore
@@ -0,0 +1,4 @@
+.gradle/
+build/
+app/build/
+local.properties
diff --git a/addons/bluetooth-toggle/README.md b/addons/bluetooth-toggle/README.md
new file mode 100644
index 000000000..ae00d6ea9
--- /dev/null
+++ b/addons/bluetooth-toggle/README.md
@@ -0,0 +1,67 @@
+# Bluetooth Toggle
+
+A one-press Bluetooth switch for the TV. For the [Clean Your TV](../../README.md) launcher it declares a
+[module card](../../docs/modules.md), so once you answer **Show card** its tile reads "Bluetooth" with a blue
+glow; on any other Android TV home it is an ordinary app.
+
+![The panel after switching Bluetooth off](screenshot.jpg)
+
+- **Open it and Bluetooth switches.** A small glass panel at the top right shows the result ("Bluetooth off"),
+ a button to switch back, and **Pair accessory**, which opens the TV's own pairing screen. It closes itself
+ after 5 seconds without a key press, or with Back.
+- **The tile cannot show the state.** A module card's label and caption are fixed text, so the tile always reads
+ "Bluetooth"; the panel says which way it went.
+- **Bluetooth remotes.** Many TV remotes pair over Bluetooth. Switch it off only if yours also works over
+ infrared, or you lose the remote until Bluetooth is back on (from the TV's own buttons, a phone app, or
+ `adb shell svc bluetooth enable`). The Hisense 75U75N remote falls back to infrared (its key presses then
+ come from the TV's IR receiver); its voice button was not tried with Bluetooth off. Headphones, speakers and
+ game controllers disconnect while it is off.
+
+## Options
+
+Set in `app/src/main/res/values/options.xml` before building.
+
+| Option | Default | What it does |
+|---|---|---|
+| `switch_on_open` | `true` | Opening the add-on switches Bluetooth at once. `false` opens the panel on the current state, and **Turn on** / **Turn off** switches it. |
+| `close_after_seconds` | `5` | Seconds without a key press before the panel closes; `0` keeps it open until Back. |
+
+## Permissions
+
+| Permission | Why |
+|---|---|
+| `BLUETOOTH_CONNECT` | Android 12 and newer: switching Bluetooth and opening the pairing screen. Asked for once, with Android's own prompt, the first time it switches. |
+| `BLUETOOTH`, `BLUETOOTH_ADMIN` | Android 8 to 11 only (`maxSdkVersion` 30): the same, granted at install. |
+
+No network, no account, no telemetry, no ads, no background service: the receiver for Bluetooth's state is
+registered only while the panel is on screen.
+
+## Build and install
+
+JDK 17 and Android SDK platform 34 with build-tools 34.0.0, as for the launcher:
+
+```bash
+cd addons/bluetooth-toggle && ./gradlew assembleRelease
+TV_HOST=<tv ip> ../../tools/venv/bin/python -I ../../tools/tv.py --push app/build/outputs/apk/release/app-release.apk /data/local/tmp/addon.apk
+TV_HOST=<tv ip> ../../tools/venv/bin/python -I ../../tools/tv.py 'pm install -r /data/local/tmp/addon.apk; rm -f /data/local/tmp/addon.apk'
+```
+
+Press Home: the launcher asks once whether to show the card. Change the answer later by holding OK on
+Settings, then Module cards.
+
+## Limits
+
+- **Android 13 and newer** do not let apps switch Bluetooth (`BluetoothAdapter.enable` and `disable` return
+ false). There, turning it on goes through Android's own "turn on Bluetooth?" prompt, and turning it off is
+ left to Settings: the panel says so.
+- Pair accessory opens `com.google.android.intent.action.CONNECT_INPUT` (Google TV and Android TV), else
+ Android's Bluetooth settings, else Settings.
+
+## Tested on
+
+Hisense 75U75N (`hengshan`, MediaTek), Google TV 12 / Android 12, firmware `STT2.230310.002`: switching off and
+on from the tile, the permission prompt, Pair accessory, and the remote over infrared with Bluetooth off.
+
+## Maintainer
+
+[@justin-newman](https://github.com/justin-newman)
diff --git a/addons/bluetooth-toggle/app/build.gradle b/addons/bluetooth-toggle/app/build.gradle
new file mode 100644
index 000000000..3f28ec18a
--- /dev/null
+++ b/addons/bluetooth-toggle/app/build.gradle
@@ -0,0 +1,36 @@
+plugins {
+ id 'com.android.application'
+}
+
+android {
+ namespace 'io.github.justinnewman.bluetoothtoggle'
+ compileSdk 34
+
+ defaultConfig {
+ applicationId 'io.github.justinnewman.bluetoothtoggle'
+ minSdk 26
+ targetSdk 34
+ versionCode 1
+ versionName '1.0'
+ }
+
+ buildTypes {
+ release {
+ minifyEnabled true
+ shrinkResources true
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt')
+ // Sideloaded over ADB like the launcher: signed with the debug key. Sign your own releases with your key.
+ signingConfig signingConfigs.debug
+ }
+ }
+
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_17
+ targetCompatibility JavaVersion.VERSION_17
+ }
+}
+
+dependencies {
+ // Test only (never in the APK): plain JVM tests for the state table, src/test.
+ testImplementation 'junit:junit:4.13.2'
+}
diff --git a/addons/bluetooth-toggle/app/src/main/AndroidManifest.xml b/addons/bluetooth-toggle/app/src/main/AndroidManifest.xml
new file mode 100644
index 000000000..d003b71ca
--- /dev/null
+++ b/addons/bluetooth-toggle/app/src/main/AndroidManifest.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android">
+
+ <uses-feature android:name="android.software.leanback" android:required="false" />
+ <uses-feature android:name="android.hardware.touchscreen" android:required="false" />
+ <uses-feature android:name="android.hardware.bluetooth" android:required="false" />
+
+ <!-- Switching Bluetooth and opening the TV's pairing screen: BLUETOOTH_CONNECT on Android 12 and newer (asked
+ for once, with Android's own prompt), the two install-time permissions on Android 8 to 11. -->
+ <uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
+ <uses-permission android:name="android.permission.BLUETOOTH" android:maxSdkVersion="30" />
+ <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" android:maxSdkVersion="30" />
+
+ <application
+ android:allowBackup="false"
+ android:banner="@drawable/banner"
+ android:icon="@drawable/icon"
+ android:label="@string/app_name"
+ android:supportsRtl="false"
+ android:theme="@style/Panel">
+
+ <activity
+ android:name=".ToggleActivity"
+ android:exported="true"
+ android:excludeFromRecents="true"
+ android:launchMode="singleTask"
+ android:screenOrientation="landscape">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LEANBACK_LAUNCHER" />
+ </intent-filter>
+ <!-- Clean Your TV module card (docs/specs/card.md): the tile shows as "Bluetooth" once the owner says Show. -->
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="com.gathin.tvhome.category.DOCK_CARD" />
+ </intent-filter>
+ <meta-data android:name="com.gathin.tvhome.card" android:resource="@xml/module_card" />
+ </activity>
+ </application>
+</manifest>
diff --git a/addons/bluetooth-toggle/app/src/main/java/io/github/justinnewman/bluetoothtoggle/States.java b/addons/bluetooth-toggle/app/src/main/java/io/github/justinnewman/bluetoothtoggle/States.java
new file mode 100644
index 000000000..671c4d36f
--- /dev/null
+++ b/addons/bluetooth-toggle/app/src/main/java/io/github/justinnewman/bluetoothtoggle/States.java
@@ -0,0 +1,45 @@
+package io.github.justinnewman.bluetoothtoggle;
+
+import android.bluetooth.BluetoothAdapter;
+
+/** What the panel says and shows for each adapter state, and when an app may switch Bluetooth itself. */
+final class States {
+ /** No adapter at all (the TV has no Bluetooth). */
+ static final int NONE = -1;
+
+ private States() { }
+
+ static int words(int state) {
+ switch (state) {
+ case BluetoothAdapter.STATE_ON: return R.string.state_on;
+ case BluetoothAdapter.STATE_TURNING_ON: return R.string.state_turning_on;
+ case BluetoothAdapter.STATE_TURNING_OFF: return R.string.state_turning_off;
+ case BluetoothAdapter.STATE_OFF: return R.string.state_off;
+ default: return R.string.state_none;
+ }
+ }
+
+ static int icon(int state) {
+ return state == BluetoothAdapter.STATE_ON || state == BluetoothAdapter.STATE_TURNING_ON
+ ? R.drawable.ic_on : R.drawable.ic_off;
+ }
+
+ /** The button's action: Turn off while on (or turning on), Turn on otherwise. */
+ static int action(int state) {
+ return state == BluetoothAdapter.STATE_ON || state == BluetoothAdapter.STATE_TURNING_ON
+ ? R.string.turn_off : R.string.turn_on;
+ }
+
+ /** On or off, not on the way: only then is a switch sent. */
+ static boolean settled(int state) {
+ return state == BluetoothAdapter.STATE_ON || state == BluetoothAdapter.STATE_OFF;
+ }
+
+ /**
+ * BluetoothAdapter.enable and disable work for ordinary apps up to Android 12L (API 32). From Android 13 they
+ * return false: turning on goes through Android's own prompt then, and turning off is left to Settings.
+ */
+ static boolean appsMaySwitch(int sdk) {
+ return sdk <= 32;
+ }
+}
diff --git a/addons/bluetooth-toggle/app/src/main/java/io/github/justinnewman/bluetoothtoggle/ToggleActivity.java b/addons/bluetooth-toggle/app/src/main/java/io/github/justinnewman/bluetoothtoggle/ToggleActivity.java
new file mode 100644
index 000000000..ce2af739a
--- /dev/null
+++ b/addons/bluetooth-toggle/app/src/main/java/io/github/justinnewman/bluetoothtoggle/ToggleActivity.java
@@ -0,0 +1,198 @@
+package io.github.justinnewman.bluetoothtoggle;
+
+import android.Manifest;
+import android.annotation.SuppressLint;
+import android.app.Activity;
+import android.bluetooth.BluetoothAdapter;
+import android.bluetooth.BluetoothManager;
+import android.content.ActivityNotFoundException;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.content.pm.PackageManager;
+import android.os.Build;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.Looper;
+import android.provider.Settings;
+import android.view.KeyEvent;
+import android.view.View;
+import android.widget.TextView;
+
+/**
+ * A small panel at the top right that switches Bluetooth. With switch_on_open (options.xml) opening it switches at
+ * once and shows the result, so the Home tile is a one-press toggle; the panel then offers the way back and the TV's
+ * pairing screen, and closes itself after close_after_seconds without a key press. Nothing runs once it is closed.
+ */
+public final class ToggleActivity extends Activity {
+ private static final int ASK = 1;
+ /** Google TV's and Android TV's own "Pair accessory" screen. */
+ private static final String CONNECT_INPUT = "com.google.android.intent.action.CONNECT_INPUT";
+
+ private final Handler main = new Handler(Looper.getMainLooper());
+ private final Runnable close = this::finish;
+ private final BroadcastReceiver changes = new BroadcastReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ show();
+ }
+ };
+ private BluetoothAdapter adapter;
+ private TextView state;
+ private TextView note;
+ private TextView toggle;
+ private TextView pair;
+ private long closeMs;
+ /** Switch once the window is up: on first open, and again when the tile is pressed while the panel shows. */
+ private boolean switchPending;
+
+ @Override
+ protected void onCreate(Bundle saved) {
+ super.onCreate(saved);
+ setContentView(R.layout.activity_toggle);
+ BluetoothManager manager = getSystemService(BluetoothManager.class);
+ adapter = manager != null ? manager.getAdapter() : null;
+ state = findViewById(R.id.state);
+ note = findViewById(R.id.note);
+ toggle = findViewById(R.id.toggle);
+ pair = findViewById(R.id.pair);
+ toggle.setOnClickListener(v -> flip());
+ pair.setOnClickListener(v -> openPairing());
+ closeMs = Math.max(0, getResources().getInteger(R.integer.close_after_seconds)) * 1000L;
+ switchPending = saved == null && getResources().getBoolean(R.bool.switch_on_open);
+ toggle.requestFocus();
+ }
+
+ @Override
+ protected void onNewIntent(Intent intent) {
+ super.onNewIntent(intent);
+ setIntent(intent);
+ if (getResources().getBoolean(R.bool.switch_on_open)) switchPending = true;
+ }
+
+ @Override
+ protected void onResume() {
+ super.onResume();
+ IntentFilter filter = new IntentFilter(BluetoothAdapter.ACTION_STATE_CHANGED);
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
+ registerReceiver(changes, filter, Context.RECEIVER_NOT_EXPORTED);
+ } else {
+ registerReceiver(changes, filter);
+ }
+ show();
+ if (switchPending) {
+ switchPending = false;
+ flip();
+ }
+ armClose();
+ }
+
+ @Override
+ protected void onPause() {
+ super.onPause();
+ unregisterReceiver(changes);
+ main.removeCallbacks(close);
+ }
+
+ @Override
+ protected void onStop() {
+ super.onStop();
+ // A panel, not a page: once something else is on screen it has done its job.
+ if (!isChangingConfigurations()) finish();
+ }
+
+ @Override
+ public boolean dispatchKeyEvent(KeyEvent event) {
+ armClose();
+ return super.dispatchKeyEvent(event);
+ }
+
+ private void armClose() {
+ main.removeCallbacks(close);
+ if (closeMs > 0) main.postDelayed(close, closeMs);
+ }
+
+ private boolean needsPermission() {
+ return Build.VERSION.SDK_INT >= Build.VERSION_CODES.S
+ && checkSelfPermission(Manifest.permission.BLUETOOTH_CONNECT) != PackageManager.PERMISSION_GRANTED;
+ }
+
+ @SuppressLint("MissingPermission")
+ private int currentState() {
+ if (adapter == null) return States.NONE;
+ try {
+ return adapter.getState();
+ } catch (SecurityException notGranted) {
+ return States.NONE;
+ }
+ }
+
+ @SuppressLint("MissingPermission")
+ @SuppressWarnings("deprecation")
+ private void flip() {
+ if (adapter == null) {
+ show();
+ return;
+ }
+ if (needsPermission()) {
+ requestPermissions(new String[]{Manifest.permission.BLUETOOTH_CONNECT}, ASK);
+ return;
+ }
+ int now = currentState();
+ if (!States.settled(now)) return;
+ boolean on = now == BluetoothAdapter.STATE_ON;
+ boolean sent = false;
+ if (States.appsMaySwitch(Build.VERSION.SDK_INT)) {
+ try {
+ sent = on ? adapter.disable() : adapter.enable();
+ } catch (SecurityException notGranted) {
+ sent = false;
+ }
+ }
+ if (!sent) {
+ if (!on && open(new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE))) return;
+ showNote(on && !States.appsMaySwitch(Build.VERSION.SDK_INT) ? R.string.settings_only : R.string.not_switched);
+ }
+ show();
+ }
+
+ @Override
+ public void onRequestPermissionsResult(int request, String[] permissions, int[] results) {
+ super.onRequestPermissionsResult(request, permissions, results);
+ if (request != ASK) return;
+ if (results.length > 0 && results[0] == PackageManager.PERMISSION_GRANTED) flip();
+ else showNote(R.string.need_permission);
+ }
+
+ private void openPairing() {
+ if (open(new Intent(CONNECT_INPUT)) || open(new Intent(Settings.ACTION_BLUETOOTH_SETTINGS))
+ || open(new Intent(Settings.ACTION_SETTINGS))) {
+ finish();
+ }
+ }
+
+ private boolean open(Intent intent) {
+ try {
+ startActivity(intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
+ return true;
+ } catch (ActivityNotFoundException | SecurityException unavailable) {
+ return false;
+ }
+ }
+
+ private void show() {
+ int now = currentState();
+ state.setText(States.words(now));
+ state.setCompoundDrawablesRelativeWithIntrinsicBounds(States.icon(now), 0, 0, 0);
+ boolean any = now != States.NONE;
+ toggle.setVisibility(any ? View.VISIBLE : View.GONE);
+ pair.setVisibility(any ? View.VISIBLE : View.GONE);
+ toggle.setText(States.action(now));
+ }
+
+ private void showNote(int words) {
+ note.setText(words);
+ note.setVisibility(View.VISIBLE);
+ }
+}
diff --git a/addons/bluetooth-toggle/app/src/main/res/color/row_text.xml b/addons/bluetooth-toggle/app/src/main/res/color/row_text.xml
new file mode 100644
index 000000000..b7bf26160
--- /dev/null
+++ b/addons/bluetooth-toggle/app/src/main/res/color/row_text.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:state_focused="true" android:color="#FF111111" />
+ <item android:color="#E6FFFFFF" />
+</selector>
diff --git a/addons/bluetooth-toggle/app/src/main/res/drawable/banner.xml b/addons/bluetooth-toggle/app/src/main/res/drawable/banner.xml
new file mode 100644
index 000000000..ccc617df6
--- /dev/null
+++ b/addons/bluetooth-toggle/app/src/main/res/drawable/banner.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- The TV banner: the Bluetooth rune on a deep blue field. Drawn for this add-on, no third-party art. -->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="320dp" android:height="180dp"
+ android:viewportWidth="320" android:viewportHeight="180">
+ <path android:fillColor="#FF14306B" android:pathData="M0,0h320v180h-320z" />
+ <path android:fillColor="#FF1D4A9E" android:pathData="M160,90m-62,0a62,62 0,1 1,124 0a62,62 0,1 1,-124 0" />
+ <group android:translateX="124" android:translateY="54" android:scaleX="3" android:scaleY="3">
+ <path android:fillColor="#FFFFFFFF"
+ android:pathData="M17.71,7.71L12,2h-1v7.59L6.41,5 5,6.41 10.59,12 5,17.59 6.41,19 11,14.41V22h1l5.71,-5.71 -4.3,-4.29 4.3,-4.29zM13,5.83l1.88,1.88L13,9.59V5.83zM14.88,16.29L13,18.17v-3.76l1.88,1.88z" />
+ </group>
+</vector>
diff --git a/addons/bluetooth-toggle/app/src/main/res/drawable/ic_off.xml b/addons/bluetooth-toggle/app/src/main/res/drawable/ic_off.xml
new file mode 100644
index 000000000..52a044e27
--- /dev/null
+++ b/addons/bluetooth-toggle/app/src/main/res/drawable/ic_off.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="32dp" android:height="32dp"
+ android:viewportWidth="24" android:viewportHeight="24">
+ <path android:fillColor="#99FFFFFF"
+ android:pathData="M13,5.83l1.88,1.88 -1.6,1.6 1.41,1.41 3.02,-3.02L12,2h-1v5.03l2,2v-3.2zM5.41,4L4,5.41 10.59,12 5,17.59 6.41,19 11,14.41V22h1l4.29,-4.29 2.3,2.29L20,18.59 5.41,4zM13,18.17v-3.76l1.88,1.88L13,18.17z" />
+</vector>
diff --git a/addons/bluetooth-toggle/app/src/main/res/drawable/ic_on.xml b/addons/bluetooth-toggle/app/src/main/res/drawable/ic_on.xml
new file mode 100644
index 000000000..5dc36ed7a
--- /dev/null
+++ b/addons/bluetooth-toggle/app/src/main/res/drawable/ic_on.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="32dp" android:height="32dp"
+ android:viewportWidth="24" android:viewportHeight="24">
+ <path android:fillColor="#FFFFFFFF"
+ android:pathData="M17.71,7.71L12,2h-1v7.59L6.41,5 5,6.41 10.59,12 5,17.59 6.41,19 11,14.41V22h1l5.71,-5.71 -4.3,-4.29 4.3,-4.29zM13,5.83l1.88,1.88L13,9.59V5.83zM14.88,16.29L13,18.17v-3.76l1.88,1.88z" />
+</vector>
diff --git a/addons/bluetooth-toggle/app/src/main/res/drawable/icon.xml b/addons/bluetooth-toggle/app/src/main/res/drawable/icon.xml
new file mode 100644
index 000000000..d24f9e552
--- /dev/null
+++ b/addons/bluetooth-toggle/app/src/main/res/drawable/icon.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- The app icon: the banner's rune, square. -->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="48dp" android:height="48dp"
+ android:viewportWidth="24" android:viewportHeight="24">
+ <path android:fillColor="#FF1D4A9E" android:pathData="M0,0h24v24h-24z" />
+ <path android:fillColor="#FFFFFFFF"
+ android:pathData="M17.71,7.71L12,2h-1v7.59L6.41,5 5,6.41 10.59,12 5,17.59 6.41,19 11,14.41V22h1l5.71,-5.71 -4.3,-4.29 4.3,-4.29zM13,5.83l1.88,1.88L13,9.59V5.83zM14.88,16.29L13,18.17v-3.76l1.88,1.88z" />
+</vector>
diff --git a/addons/bluetooth-toggle/app/src/main/res/drawable/panel.xml b/addons/bluetooth-toggle/app/src/main/res/drawable/panel.xml
new file mode 100644
index 000000000..24d9b468f
--- /dev/null
+++ b/addons/bluetooth-toggle/app/src/main/res/drawable/panel.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Dark glass, no blur (the launcher targets TVs with 1 GB of RAM). -->
+<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
+ <solid android:color="#EB1B1C20" />
+ <stroke android:width="1dp" android:color="#26FFFFFF" />
+ <corners android:radius="22dp" />
+</shape>
diff --git a/addons/bluetooth-toggle/app/src/main/res/drawable/row.xml b/addons/bluetooth-toggle/app/src/main/res/drawable/row.xml
new file mode 100644
index 000000000..31fc0c761
--- /dev/null
+++ b/addons/bluetooth-toggle/app/src/main/res/drawable/row.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- A button row: white when focused, faint glass otherwise. -->
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:state_focused="true">
+ <shape android:shape="rectangle">
+ <solid android:color="#F2FFFFFF" />
+ <corners android:radius="14dp" />
+ </shape>
+ </item>
+ <item>
+ <shape android:shape="rectangle">
+ <solid android:color="#14FFFFFF" />
+ <corners android:radius="14dp" />
+ </shape>
+ </item>
+</selector>
diff --git a/addons/bluetooth-toggle/app/src/main/res/layout/activity_toggle.xml b/addons/bluetooth-toggle/app/src/main/res/layout/activity_toggle.xml
new file mode 100644
index 000000000..be1360f35
--- /dev/null
+++ b/addons/bluetooth-toggle/app/src/main/res/layout/activity_toggle.xml
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- A compact glass panel at the top right, over whatever is on screen. -->
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+
+ <LinearLayout
+ android:id="@+id/panel"
+ android:layout_width="380dp"
+ android:layout_height="wrap_content"
+ android:layout_gravity="top|end"
+ android:layout_marginTop="40dp"
+ android:layout_marginEnd="48dp"
+ android:background="@drawable/panel"
+ android:orientation="vertical"
+ android:padding="22dp">
+
+ <TextView
+ android:id="@+id/state"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:drawablePadding="14dp"
+ android:gravity="center_vertical"
+ android:textColor="#FFFFFFFF"
+ android:textSize="22sp" />
+
+ <TextView
+ android:id="@+id/note"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="10dp"
+ android:textColor="#B3FFFFFF"
+ android:textSize="14sp"
+ android:visibility="gone" />
+
+ <TextView
+ android:id="@+id/toggle"
+ android:layout_width="match_parent"
+ android:layout_height="48dp"
+ android:layout_marginTop="18dp"
+ android:background="@drawable/row"
+ android:focusable="true"
+ android:gravity="center_vertical"
+ android:paddingStart="18dp"
+ android:paddingEnd="18dp"
+ android:textColor="@color/row_text"
+ android:textSize="16sp" />
+
+ <TextView
+ android:id="@+id/pair"
+ android:layout_width="match_parent"
+ android:layout_height="48dp"
+ android:layout_marginTop="8dp"
+ android:background="@drawable/row"
+ android:focusable="true"
+ android:gravity="center_vertical"
+ android:paddingStart="18dp"
+ android:paddingEnd="18dp"
+ android:text="@string/pair"
+ android:textColor="@color/row_text"
+ android:textSize="16sp" />
+ </LinearLayout>
+</FrameLayout>
diff --git a/addons/bluetooth-toggle/app/src/main/res/values/options.xml b/addons/bluetooth-toggle/app/src/main/res/values/options.xml
new file mode 100644
index 000000000..83819a262
--- /dev/null
+++ b/addons/bluetooth-toggle/app/src/main/res/values/options.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Options, set before building. -->
+<resources>
+ <!-- true: opening the add-on (its Home tile or the app list) switches Bluetooth at once and shows the result.
+ false: it opens on the current state, and Turn on / Turn off switches it. -->
+ <bool name="switch_on_open">true</bool>
+ <!-- Seconds without a key press before the panel closes itself; 0 keeps it open until Back. -->
+ <integer name="close_after_seconds">5</integer>
+</resources>
diff --git a/addons/bluetooth-toggle/app/src/main/res/values/strings.xml b/addons/bluetooth-toggle/app/src/main/res/values/strings.xml
new file mode 100644
index 000000000..fcfd204d4
--- /dev/null
+++ b/addons/bluetooth-toggle/app/src/main/res/values/strings.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <string name="app_name">Bluetooth</string>
+
+ <string name="state_on">Bluetooth on</string>
+ <string name="state_off">Bluetooth off</string>
+ <string name="state_turning_on">Turning Bluetooth on</string>
+ <string name="state_turning_off">Turning Bluetooth off</string>
+ <string name="state_none">This TV has no Bluetooth</string>
+
+ <string name="turn_on">Turn on</string>
+ <string name="turn_off">Turn off</string>
+ <string name="pair">Pair accessory</string>
+ <string name="settings">Bluetooth settings</string>
+
+ <string name="need_permission">Allow Bluetooth access to switch it from here.</string>
+ <string name="settings_only">This Android version lets only Settings switch Bluetooth off.</string>
+ <string name="not_switched">Bluetooth could not be switched.</string>
+</resources>
diff --git a/addons/bluetooth-toggle/app/src/main/res/values/styles.xml b/addons/bluetooth-toggle/app/src/main/res/values/styles.xml
new file mode 100644
index 000000000..e08e215e1
--- /dev/null
+++ b/addons/bluetooth-toggle/app/src/main/res/values/styles.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <!-- A see-through window: the panel floats over whatever was on screen, as the launcher's own menus do. -->
+ <style name="Panel" parent="@android:style/Theme.Material.NoActionBar.Fullscreen">
+ <item name="android:windowIsTranslucent">true</item>
+ <item name="android:windowBackground">@android:color/transparent</item>
+ <item name="android:backgroundDimEnabled">false</item>
+ </style>
+</resources>
diff --git a/addons/bluetooth-toggle/app/src/main/res/xml/module_card.xml b/addons/bluetooth-toggle/app/src/main/res/xml/module_card.xml
new file mode 100644
index 000000000..895738d02
--- /dev/null
+++ b/addons/bluetooth-toggle/app/src/main/res/xml/module_card.xml
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="utf-8"?>
+<card spec="1" label="Bluetooth" caption="Switch it on and off" accent="#3D7BE0" />
diff --git a/addons/bluetooth-toggle/app/src/test/java/io/github/justinnewman/bluetoothtoggle/StatesTest.java b/addons/bluetooth-toggle/app/src/test/java/io/github/justinnewman/bluetoothtoggle/StatesTest.java
new file mode 100644
index 000000000..75bfba448
--- /dev/null
+++ b/addons/bluetooth-toggle/app/src/test/java/io/github/justinnewman/bluetoothtoggle/StatesTest.java
@@ -0,0 +1,49 @@
+package io.github.justinnewman.bluetoothtoggle;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import android.bluetooth.BluetoothAdapter;
+
+import org.junit.Test;
+
+/** The table behind the panel: words, icon and button for each adapter state, and when an app may switch. */
+public class StatesTest {
+ @Test
+ public void wordsFollowTheAdapter() {
+ assertEquals(R.string.state_on, States.words(BluetoothAdapter.STATE_ON));
+ assertEquals(R.string.state_off, States.words(BluetoothAdapter.STATE_OFF));
+ assertEquals(R.string.state_turning_on, States.words(BluetoothAdapter.STATE_TURNING_ON));
+ assertEquals(R.string.state_turning_off, States.words(BluetoothAdapter.STATE_TURNING_OFF));
+ assertEquals(R.string.state_none, States.words(States.NONE));
+ }
+
+ @Test
+ public void theButtonOffersTheWayBack() {
+ assertEquals(R.string.turn_off, States.action(BluetoothAdapter.STATE_ON));
+ assertEquals(R.string.turn_off, States.action(BluetoothAdapter.STATE_TURNING_ON));
+ assertEquals(R.string.turn_on, States.action(BluetoothAdapter.STATE_OFF));
+ assertEquals(R.string.turn_on, States.action(BluetoothAdapter.STATE_TURNING_OFF));
+ assertEquals(R.drawable.ic_on, States.icon(BluetoothAdapter.STATE_ON));
+ assertEquals(R.drawable.ic_off, States.icon(BluetoothAdapter.STATE_OFF));
+ }
+
+ @Test
+ public void onlyASettledStateIsSwitched() {
+ assertTrue(States.settled(BluetoothAdapter.STATE_ON));
+ assertTrue(States.settled(BluetoothAdapter.STATE_OFF));
+ assertFalse(States.settled(BluetoothAdapter.STATE_TURNING_ON));
+ assertFalse(States.settled(BluetoothAdapter.STATE_TURNING_OFF));
+ assertFalse(States.settled(States.NONE));
+ }
+
+ @Test
+ public void appsMaySwitchUpToAndroid12L() {
+ assertTrue(States.appsMaySwitch(26));
+ assertTrue(States.appsMaySwitch(31));
+ assertTrue(States.appsMaySwitch(32));
+ assertFalse(States.appsMaySwitch(33));
+ assertFalse(States.appsMaySwitch(34));
+ }
+}
diff --git a/addons/bluetooth-toggle/build.gradle b/addons/bluetooth-toggle/build.gradle
new file mode 100644
index 000000000..48978475f
--- /dev/null
+++ b/addons/bluetooth-toggle/build.gradle
@@ -0,0 +1,3 @@
+plugins {
+ id 'com.android.application' version '8.5.2' apply false
+}
diff --git a/addons/bluetooth-toggle/gradle.properties b/addons/bluetooth-toggle/gradle.properties
new file mode 100644
index 000000000..1edaf2baa
--- /dev/null
+++ b/addons/bluetooth-toggle/gradle.properties
@@ -0,0 +1 @@
+org.gradle.jvmargs=-Xmx2g -Dfile.encoding=UTF-8
diff --git a/addons/bluetooth-toggle/gradle/wrapper/gradle-wrapper.jar b/addons/bluetooth-toggle/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 000000000..2c3521197
Binary files /dev/null and b/addons/bluetooth-toggle/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/addons/bluetooth-toggle/gradle/wrapper/gradle-wrapper.properties b/addons/bluetooth-toggle/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 000000000..77f5d0ba6
--- /dev/null
+++ b/addons/bluetooth-toggle/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,8 @@
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
+distributionSha256Sum=d725d707bfabd4dfdc958c624003b3c80accc03f7037b5122c4b1d0ef15cecab
+networkTimeout=10000
+validateDistributionUrl=true
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
diff --git a/addons/bluetooth-toggle/gradlew b/addons/bluetooth-toggle/gradlew
new file mode 100644
index 000000000..f5feea6d6
--- /dev/null
+++ b/addons/bluetooth-toggle/gradlew
@@ -0,0 +1,252 @@
+#!/bin/sh
+
+#
+# Copyright © 2015-2021 the original authors.
+#
+# 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
+#
+# https://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.
+#
+# SPDX-License-Identifier: Apache-2.0
+#
+
+##############################################################################
+#
+# Gradle start up script for POSIX generated by Gradle.
+#
+# Important for running:
+#
+# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
+# noncompliant, but you have some other compliant shell such as ksh or
+# bash, then to run this script, type that shell name before the whole
+# command line, like:
+#
+# ksh Gradle
+#
+# Busybox and similar reduced shells will NOT work, because this script
+# requires all of these POSIX shell features:
+# * functions;
+# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
+# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
+# * compound commands having a testable exit status, especially «case»;
+# * various built-in commands including «command», «set», and «ulimit».
+#
+# Important for patching:
+#
+# (2) This script targets any POSIX shell, so it avoids extensions provided
+# by Bash, Ksh, etc; in particular arrays are avoided.
+#
+# The "traditional" practice of packing multiple parameters into a
+# space-separated string is a well documented source of bugs and security
+# problems, so this is (mostly) avoided, by progressively accumulating
+# options in "$@", and eventually passing that to Java.
+#
+# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
+# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
+# see the in-line comments for details.
+#
+# There are tweaks for specific operating systems such as AIX, CygWin,
+# Darwin, MinGW, and NonStop.
+#
+# (3) This script is generated from the Groovy template
+# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
+# within the Gradle project.
+#
+# You can find Gradle at https://github.com/gradle/gradle/.
+#
+##############################################################################
+
+# Attempt to set APP_HOME
+
+# Resolve links: $0 may be a link
+app_path=$0
+
+# Need this for daisy-chained symlinks.
+while
+ APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
+ [ -h "$app_path" ]
+do
+ ls=$( ls -ld "$app_path" )
+ link=${ls#*' -> '}
+ case $link in #(
+ /*) app_path=$link ;; #(
+ *) app_path=$APP_HOME$link ;;
+ esac
+done
+
+# This is normally unused
+# shellcheck disable=SC2034
+APP_BASE_NAME=${0##*/}
+# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
+APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
+' "$PWD" ) || exit
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD=maximum
+
+warn () {
+ echo "$*"
+} >&2
+
+die () {
+ echo
+ echo "$*"
+ echo
+ exit 1
+} >&2
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+nonstop=false
+case "$( uname )" in #(
+ CYGWIN* ) cygwin=true ;; #(
+ Darwin* ) darwin=true ;; #(
+ MSYS* | MINGW* ) msys=true ;; #(
+ NONSTOP* ) nonstop=true ;;
+esac
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD=$JAVA_HOME/jre/sh/java
+ else
+ JAVACMD=$JAVA_HOME/bin/java
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD=java
+ if ! command -v java >/dev/null 2>&1
+ then
+ die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+fi
+
+# Increase the maximum file descriptors if we can.
+if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
+ case $MAX_FD in #(
+ max*)
+ # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
+ # shellcheck disable=SC2039,SC3045
+ MAX_FD=$( ulimit -H -n ) ||
+ warn "Could not query maximum file descriptor limit"
+ esac
+ case $MAX_FD in #(
+ '' | soft) :;; #(
+ *)
+ # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
+ # shellcheck disable=SC2039,SC3045
+ ulimit -n "$MAX_FD" ||
+ warn "Could not set maximum file descriptor limit to $MAX_FD"
+ esac
+fi
+
+# Collect all arguments for the java command, stacking in reverse order:
+# * args from the command line
+# * the main class name
+# * -classpath
+# * -D...appname settings
+# * --module-path (only if needed)
+# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
+
+# For Cygwin or MSYS, switch paths to Windows format before running java
+if "$cygwin" || "$msys" ; then
+ APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
+ CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
+
+ JAVACMD=$( cygpath --unix "$JAVACMD" )
+
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ for arg do
+ if
+ case $arg in #(
+ -*) false ;; # don't mess with options #(
+ /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
+ [ -e "$t" ] ;; #(
+ *) false ;;
+ esac
+ then
+ arg=$( cygpath --path --ignore --mixed "$arg" )
+ fi
+ # Roll the args list around exactly as many times as the number of
+ # args, so each arg winds up back in the position where it started, but
+ # possibly modified.
+ #
+ # NB: a `for` loop captures its iteration list before it begins, so
+ # changing the positional parameters here affects neither the number of
+ # iterations, nor the values presented in `arg`.
+ shift # remove old arg
+ set -- "$@" "$arg" # push replacement arg
+ done
+fi
+
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
+
+# Collect all arguments for the java command:
+# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
+# and any embedded shellness will be escaped.
+# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
+# treated as '${Hostname}' itself on the command line.
+
+set -- \
+ "-Dorg.gradle.appname=$APP_BASE_NAME" \
+ -classpath "$CLASSPATH" \
+ org.gradle.wrapper.GradleWrapperMain \
+ "$@"
+
+# Stop when "xargs" is not available.
+if ! command -v xargs >/dev/null 2>&1
+then
+ die "xargs is not available"
+fi
+
+# Use "xargs" to parse quoted args.
+#
+# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
+#
+# In Bash we could simply go:
+#
+# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
+# set -- "${ARGS[@]}" "$@"
+#
+# but POSIX shell has neither arrays nor command substitution, so instead we
+# post-process each arg (as a line of input to sed) to backslash-escape any
+# character that might be a shell metacharacter, then use eval to reverse
+# that process (while maintaining the separation between arguments), and wrap
+# the whole thing up as a single "set" statement.
+#
+# This will of course break if any of these variables contains a newline or
+# an unmatched quote.
+#
+
+eval "set -- $(
+ printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
+ xargs -n1 |
+ sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
+ tr '\n' ' '
+ )" '"$@"'
+
+exec "$JAVACMD" "$@"
diff --git a/addons/bluetooth-toggle/gradlew.bat b/addons/bluetooth-toggle/gradlew.bat
new file mode 100644
index 000000000..9d21a2183
--- /dev/null
+++ b/addons/bluetooth-toggle/gradlew.bat
@@ -0,0 +1,94 @@
+@rem
+@rem Copyright 2015 the original author or authors.
+@rem
+@rem Licensed under the Apache License, Version 2.0 (the "License");
+@rem you may not use this file except in compliance with the License.
+@rem You may obtain a copy of the License at
+@rem
+@rem https://www.apache.org/licenses/LICENSE-2.0
+@rem
+@rem Unless required by applicable law or agreed to in writing, software
+@rem distributed under the License is distributed on an "AS IS" BASIS,
+@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@rem See the License for the specific language governing permissions and
+@rem limitations under the License.
+@rem
+@rem SPDX-License-Identifier: Apache-2.0
+@rem
+
+@if "%DEBUG%"=="" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%"=="" set DIRNAME=.
+@rem This is normally unused
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Resolve any "." and ".." in APP_HOME to make it shorter.
+for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if %ERRORLEVEL% equ 0 goto execute
+
+echo. 1>&2
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
+echo. 1>&2
+echo Please set the JAVA_HOME variable in your environment to match the 1>&2
+echo location of your Java installation. 1>&2
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto execute
+
+echo. 1>&2
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
+echo. 1>&2
+echo Please set the JAVA_HOME variable in your environment to match the 1>&2
+echo location of your Java installation. 1>&2
+
+goto fail
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
+
+:end
+@rem End local scope for the variables with windows NT shell
+if %ERRORLEVEL% equ 0 goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+set EXIT_CODE=%ERRORLEVEL%
+if %EXIT_CODE% equ 0 set EXIT_CODE=1
+if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
+exit /b %EXIT_CODE%
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/addons/bluetooth-toggle/settings.gradle b/addons/bluetooth-toggle/settings.gradle
new file mode 100644
index 000000000..a718a698e
--- /dev/null
+++ b/addons/bluetooth-toggle/settings.gradle
@@ -0,0 +1,16 @@
+pluginManagement {
+ repositories {
+ google()
+ mavenCentral()
+ gradlePluginPortal()
+ }
+}
+dependencyResolutionManagement {
+ repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
+ repositories {
+ google()
+ mavenCentral()
+ }
+}
+rootProject.name = "bluetooth-toggle"
+include ':app'