Skip to content

Commit 6154b10

Browse files
committed
Merge branch 'release/1.0.0'.
* release/1.0.0: Bump version for release '1.0.0'. Update README with detailed info & instructions. Add signing configuration to build settings. Add icon to layout of main activity. Update artwork. Remove logging leftovers. Enable home receiver to act on wake events. Add receiver to intercept boot events. Ensure that home service is being enabled. Add service to intercept home button presses. Add helper methods to launch the selected app. Improve layout of main activity. Display help dialog when missing permission. Display status message when missing permission. Add helper method to check granted permissions. Remove log messages. Fix missing cast. Add dropdown menu to select launcher app. Add class to hold global preferences. Add helper method to get all installed apps. Add adapter to provide app-specific list items. Add model to hold basic information about an app.
2 parents a9047e1 + bab271b commit 6154b10

File tree

23 files changed

+915
-19
lines changed

23 files changed

+915
-19
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/.idea/
22
/build/
33
/captures/
4+
/keystore.properties
45
/local.properties
56
.cxx
67
.externalNativeBuild

README.md

Lines changed: 186 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,200 @@
11
FTVLaunchX — README
22
===================
33

4+
<p align="center">
5+
<img src="./app/src/main/res/mipmap-xxhdpi/ic_launcher.png" />
6+
</p>
7+
48
About
59
-----
610

7-
...
11+
FTVLaunchX is a simple helper application to allow custom launchers on
12+
Amazon Fire TV devices.
813

9-
### Status
14+
It is inspired by the famous
15+
[LauncherHijack](https://github.com/BaronKiko/LauncherHijack) of @BaronKiko
16+
and tries to overcome several issues relating to it.
1017

11-
[ISSUES][GITHUB_ISSUES] | [RELEASES][GITHUB_RELEASES]
18+
So far FTVLaunchX has been tested on:
1219

20+
- Fire TV Stick 2nd Generation (Fire OS 5.2.7.2)
21+
- Fire TV Stick 4K (Fire OS 6.2.6.8)
1322

14-
Usage
15-
-----
23+
Please let me know if you are using it successfully on any other devices.
24+
25+
### Features
26+
27+
- Reliably intercepts any & all presses of the home button.
28+
29+
- Starts the selected launcher on boot (note that this can take
30+
up to a minute on older devices).
31+
32+
- Starts the selected launcher when waking up from sleep.
33+
34+
- Allows use of the original long-press-on-home functionality
35+
by holding down the menu key in parallel.
36+
37+
- Works with any launcher or other app like e.g.
38+
- [Android TV Launcher](https://leanback-launcher.en.aptoide.com/)
39+
- [Leanback Launcher](https://github.com/tsynik/LeanbackLauncher)
40+
- [TV Launcher 3](https://tvlauncher.en.aptoide.com/)
41+
- [Kodi](https://kodi.tv/)
42+
43+
#### Known Limitations
44+
45+
- When a screensaver is running then the home button does not cause
46+
the screensaver to exit, all other buttons do work though.
47+
48+
- Long-pressing the home button had to be replaced by a custom key
49+
combination (holding down the menu key in parallel).
50+
51+
Please let me know if you find any other issues by opening a bug report at
52+
the [issue tracker][GITHUB_ISSUES] here at GitHub – you are also very welcome
53+
to send in any feature requests.
54+
55+
### Donations
56+
57+
FTVLaunchX is and will always be totally __free__ and __without ads__.
58+
59+
But if you want to say _Thank You_ and would like to support any further
60+
development then feel free to send me a buck via PayPal:
61+
62+
[FTVLaunchX MoneyPool at PayPal](https://paypal.me/pools/c/8lNMBi7om0)
63+
64+
You can also help me out by downloading & using the Brave browser or,
65+
when you are already using Brave, by tipping me some BAT directly at my
66+
[personal GitHub profile](https://github.com/ErikAbele).
67+
68+
<p align="center">
69+
<a href="https://brave.com/eri226" title="Download Brave">
70+
<img src="https://brave.com/wp-content/uploads/2018/02/[email protected]" />
71+
</a>
72+
</p>
73+
74+
Note: you will have to use Brave minimally for at least one month so that
75+
I get credited the referral bonus.
76+
77+
78+
Documentation
79+
-------------
80+
81+
### Setup
82+
83+
#### Quick Installation Overview
84+
85+
FTVLaunchX needs the `WRITE_SECURE_SETTINGS` permission to enable an
86+
accessibility service on your Fire TV device.
87+
88+
If you know what you are doing then simply grant this permission by executing
89+
the following command in an `ADB` shell on your device:
90+
```
91+
$ pm grant de.codefaktor.ftvlaunchx android.permission.WRITE_SECURE_SETTINGS
92+
```
93+
94+
For a step-by-step guide and more information on how to connect to your
95+
Fire TV device via `ADB`, follow the detailed installation instructions below.
96+
97+
#### Detailed Installation Instructions
98+
99+
There are three ways to install FTVLaunchX: either directly on your Fire TV
100+
device via e.g. the Downloader app or, alternatively with the help of `ADB`
101+
from a mobile phone running Android or a desktop PC.
102+
103+
##### Pre-Requisites
104+
105+
1. From the main screen of your Fire TV select _Settings_
106+
2. Select _My Fire TV_ > _Developer Options_
107+
3. Turn on _ADB Debugging_
108+
4. Turn on _Apps from Unknown Sources_
109+
5. Go back to _My Fire TV_ > _About_ > _Network_
110+
6. Note the IP address of your device; you will need this later on
111+
112+
##### Method 1: directly on Fire TV
16113

17-
...
114+
1. Install the Downloader app from the Amazon App Store on your
115+
Fire TV device
116+
2. Open Downloader and navigate to
117+
`github.com/codefaktor/FTVLaunchX/releases`
118+
3. Find, download and install the latest release of FTVLaunchX
119+
4. Open Downloader and navigate to
120+
`troypoint.com/radb`
121+
5. The download should start automatically; click `Install`, then `Open`
122+
6. Follow the on-screen instructions and enter the IP address of your
123+
device when asked (see 6. in Pre-Requisites above)
124+
7. When presented with a command-line within the `Remote ADB Shell`
125+
application, enter and run the following command:
126+
```
127+
pm grant de.codefaktor.ftvlaunchx android.permission.WRITE_SECURE_SETTINGS
128+
```
129+
8. Open FTVLaunchX, select a launcher and press the home button – enjoy!
130+
131+
##### Method 2: via ADB from an Android phone
132+
133+
1. Use a browser to download the latest release of FTVLaunchX from the
134+
[release page][GITHUB_ISSUES] to your phone
135+
2. Install the [Easy Fire Tools](https://play.google.com/store/apps/details?id=de.agondev.easyfiretools)
136+
application from Google Play on your phone
137+
3. Install the [Remote ADB Shell](https://play.google.com/store/apps/details?id=com.cgutman.androidremotedebugger)
138+
application from Google Play on your phone
139+
4. Open `Easy Fire Tools`, discover & connect to your Fire TV and install
140+
the downloaded release of FTVLaunchX
141+
5. Open `Remote ADB Shell`, connect to your Fire TV by using the IP address
142+
of your device (see 6. in Pre-Requisites above) and run the following
143+
command:
144+
```
145+
pm grant de.codefaktor.ftvlaunchx android.permission.WRITE_SECURE_SETTINGS
146+
```
147+
6. Open FTVLaunchX on your Fire TV device, select a launcher and press the
148+
home button – enjoy!
149+
150+
##### Method 3: via ADB from a desktop PC or laptop
151+
152+
1. Use a browser to download the latest release of FTVLaunchX from the
153+
[release page][GITHUB_ISSUES] to your computer
154+
2. Install `ADB` and connect to your Fire TV by using the IP address
155+
of your device (see 6. in Pre-Requisites above), see
156+
[here](https://developer.amazon.com/docs/fire-tv/connecting-adb-to-device.html)
157+
for detailed instructions on how to do this
158+
3. Install the downloaded release of FTVLaunchX by executing one of the
159+
following commands (make sure to use the actual name of the downloaded
160+
file):
161+
- For devices running Fire OS 5 (Fire TV Stick 2nd Generation)
162+
```
163+
adb install FTVLaunchX-x.y.z.apk
164+
```
165+
- For devices running Fire OS 6 or 7 (Fire TV Stick 4K & Fire TV Cube)
166+
```
167+
adb install -g FTVLaunchX-x.y.z.apk
168+
```
169+
4. If your device is not running Fire OS 6 or 7 then grant the required
170+
permission by running, otherwise proceed to step 5:
171+
```
172+
adb pm grant de.codefaktor.ftvlaunchx android.permission.WRITE_SECURE_SETTINGS
173+
```
174+
5. Open FTVLaunchX on your Fire TV device, select a launcher and press the
175+
home button – enjoy!
176+
177+
Note: if you are updating FTVLaunchX with this method then you will need to
178+
add the `-r` flag to the `adb install` commands in step 3.
179+
180+
### Usage
181+
182+
Just start FTVLaunchX and select the application to use as your launcher.
183+
184+
From now on, every time you boot your device, wake it up from sleep or press
185+
the home button, you will be taken to this application.
186+
187+
As long as no launcher has been selected, FTVLaunchX will open itself.
188+
189+
#### The long-press-on-home menu
190+
191+
To access the original long-press-on-home menu or to open the settings menu
192+
of your Fire TV device, you will have to press and hold the menu and home
193+
buttons at the same time.
194+
195+
You can also get to the default Amazon home screen by using this method.
196+
197+
Lean back & enjoy!
18198

19199

20200
Copyright

app/build.gradle

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,19 @@
22

33
apply plugin: 'com.android.application'
44

5-
def versionMajor = 0
5+
def versionMajor = 1
66
def versionMinor = 0
7-
def versionPatch = 1
8-
def versionSuffix = "-dev"
7+
def versionPatch = 0
8+
def versionSuffix = ""
9+
10+
def keystorePropertiesFile = rootProject.file('keystore.properties')
11+
def keystoreProperties = new Properties()
12+
13+
if (keystorePropertiesFile.exists()) {
14+
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
15+
} else {
16+
keystoreProperties['storeFile'] = 'none'
17+
}
918

1019
android {
1120
compileSdkVersion 29
@@ -29,12 +38,22 @@ android {
2938
"${versionName}${versionNameSuffix}"
3039
}
3140

41+
signingConfigs {
42+
release {
43+
storeFile file(keystoreProperties['storeFile'])
44+
storePassword keystoreProperties['storePassword']
45+
keyAlias = keystoreProperties['keyAlias']
46+
keyPassword keystoreProperties['keyPassword']
47+
}
48+
}
49+
3250
buildTypes {
3351
release {
3452
minifyEnabled false
3553
proguardFiles \
3654
getDefaultProguardFile('proguard-android-optimize.txt'), \
3755
'proguard-rules.pro'
56+
signingConfig signingConfigs.release
3857
}
3958
}
4059
}

app/src/main/AndroidManifest.xml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,18 @@
1212
android:name="android.software.leanback"
1313
android:required="true" />
1414

15+
<uses-permission
16+
android:name="android.permission.BIND_ACCESSIBILITY_SERVICE" />
17+
18+
<uses-permission
19+
android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
20+
21+
<uses-permission
22+
android:name="android.permission.WRITE_SECURE_SETTINGS" />
23+
24+
<uses-permission
25+
android:name="android.permission.WRITE_SETTINGS" />
26+
1527
<application
1628
android:allowBackup="true"
1729
android:banner="@drawable/banner"
@@ -30,5 +42,25 @@
3042
android:name="android.intent.category.LEANBACK_LAUNCHER" />
3143
</intent-filter>
3244
</activity>
45+
46+
<receiver
47+
android:name=".HomeReceiver"
48+
android:permission="android.permission.RECEIVE_BOOT_COMPLETED">
49+
<intent-filter>
50+
<action android:name="android.intent.action.BOOT_COMPLETED" />
51+
</intent-filter>
52+
</receiver>
53+
54+
<service
55+
android:name=".HomeService"
56+
android:permission="android.permission.BIND_ACCESSIBILITY_SERVICE">
57+
<intent-filter>
58+
<action
59+
android:name="android.accessibilityservice.AccessibilityService" />
60+
</intent-filter>
61+
<meta-data
62+
android:name="android.accessibilityservice"
63+
android:resource="@xml/accessibility_service_config" />
64+
</service>
3365
</application>
3466
</manifest>
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
* ### FTVLaunchX: Home Receiver
3+
*
4+
* Copyright © 2020 [Erik Abele](http://www.codefaktor.de/).
5+
*
6+
* Licensed under the
7+
* [Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0).
8+
*/
9+
10+
package de.codefaktor.ftvlaunchx;
11+
12+
import android.content.BroadcastReceiver;
13+
import android.content.Context;
14+
import android.content.Intent;
15+
import android.util.Log;
16+
17+
/**
18+
* Implements HomeReceiver.
19+
*/
20+
21+
public class HomeReceiver extends BroadcastReceiver {
22+
private static final String TAG = "HomeReceiver";
23+
24+
@Override
25+
public void onReceive(Context ctx, Intent intent) {
26+
String launcherPackage = Preferences.getLauncherPackage(ctx);
27+
28+
Log.i(TAG, "Launching alternative home <" + launcherPackage +
29+
"> for " + intent.getAction());
30+
31+
Utilities.launchPackage(ctx, launcherPackage);
32+
}
33+
}

0 commit comments

Comments
 (0)