Skip to content
This repository was archived by the owner on Mar 22, 2026. It is now read-only.

Commit fb5b847

Browse files
committed
Remove alpha tag, 'Anti-theft helper'
- Remove the alpha tag. The version name is now 7.0 - Change the name of 'Shutdown protection' to 'Anti-theft helper' (as in the future toggle airplane mode will be disabled as well) - Do some stub for disabling toggle airplane mode
1 parent 1985978 commit fb5b847

3 files changed

Lines changed: 39 additions & 9 deletions

File tree

AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
22
package="hk.kennethso168.xposed.advancedrebootmenu"
33
android:versionCode="11"
4-
android:versionName="7.0a_r2" >
4+
android:versionName="7.0" >
55

66
<uses-sdk
77
android:minSdkVersion="14"

res/values/strings.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@
4848
<!-- Do not translate or include the "default" strings in other languages -->
4949
<string name="confirm_dialog_default">0</string>
5050
<string name="icon_color_title_default">0</string>
51-
<string name="no_locked_off_title">Shutdown Protection</string>
52-
<string name="no_locked_off_summ">Disable shutdown and reboot functions while the device is still at the lockscreen and not yet unlocked</string>
53-
<string name="no_locked_off_dialog">Because shutdown protection is on, you may not power off the phone while the device is locked. Unlock the device and try again.</string>
51+
<string name="no_locked_off_title">Anti-theft helper</string>
52+
<string name="no_locked_off_summ">Disable shutdown, reboot and airplane mode functions while the device is still at the lockscreen and not yet unlocked</string>
53+
<string name="no_locked_off_dialog">Because anti-theft helper is on, you may not power off the phone or turn on airplane mode while the device is locked. Unlock the device and try again.</string>
5454

5555
<string name="sect_debug">App Options</string>
5656
<string name="verbose_log_title">Verbose logging</string>

src/hk/kennethso168/xposed/advancedrebootmenu/ModRebootMenu.java

Lines changed: 35 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public class ModRebootMenu {
7676
private static String noLockedOffDialogMsg;
7777
private static Unhook mRebootActionHook;
7878
private static Unhook mPowerOffActionHook;
79-
private static Method mPowerOffOrigMethod;
79+
private static Unhook mAirplaneActionHook;
8080
private static XSharedPreferences xPref;
8181

8282
//reboot shell commands
@@ -221,6 +221,11 @@ protected void beforeHookedMethod(final MethodHookParam param) throws Throwable
221221
mPowerOffActionHook.unhook();
222222
mPowerOffActionHook = null;
223223
}
224+
if (mAirplaneActionHook != null) {
225+
log("Unhooking previous hook of airplane action item");
226+
mAirplaneActionHook.unhook();
227+
mAirplaneActionHook = null;
228+
}
224229
}
225230

226231
@Override
@@ -242,6 +247,7 @@ protected void afterHookedMethod(final MethodHookParam param) throws Throwable {
242247
Object rebootActionItem = null;
243248
Object screenshotActionItem = null;
244249
Object powerOffActionItem = null;
250+
Object airplaneActionItem = null;
245251
Resources res = mContext.getResources();
246252
for (Object o : mItems) {
247253
// search for drawable
@@ -259,6 +265,9 @@ protected void afterHookedMethod(final MethodHookParam param) throws Throwable {
259265
|| resName.contains("shut")||resName.contains("off")) {
260266
powerOffActionItem = o;
261267
}
268+
if (resName.contains("airplane")){
269+
airplaneActionItem = o;
270+
}
262271
} catch (NoSuchFieldError nfe) {
263272
// continue
264273
} catch (Resources.NotFoundException resnfe) {
@@ -276,12 +285,13 @@ protected void afterHookedMethod(final MethodHookParam param) throws Throwable {
276285
}
277286
if (resName.contains("screenshot")) {
278287
screenshotActionItem = o;
279-
280288
}
281289
if (resName.contains("power") || resName.contains("shutdown")
282290
|| resName.contains("shut")||resName.contains("off")) {
283291
powerOffActionItem = o;
284-
292+
}
293+
if (resName.contains("airplane")){
294+
airplaneActionItem = o;
285295
}
286296
} catch (NoSuchFieldError nfe) {
287297
// continue
@@ -300,7 +310,6 @@ protected void afterHookedMethod(final MethodHookParam param) throws Throwable {
300310
@Override
301311
protected Object replaceHookedMethod(MethodHookParam param) throws Throwable {
302312
if(normalRebootOnly){
303-
// TODO handle this when shutdown protection is on
304313
KeyguardManager myKM = (KeyguardManager) mContext.getSystemService(Context.KEYGUARD_SERVICE);
305314
if( myKM.inKeyguardRestrictedInputMode()&&noLockedOff) {
306315
log("Is at lockscreen and shutdown protection is on");
@@ -386,7 +395,28 @@ protected Object replaceHookedMethod(MethodHookParam param) throws Throwable {
386395
} else {
387396
log("Existing Power off action item NOT found!");
388397
}
389-
398+
// TODO Find a way to disable the airplaneActionItem
399+
// airplaneActionItem is differently coded so that it doesn't have the onPress method
400+
/*
401+
if (airplaneActionItem != null) {
402+
log("Existing airplane action item found!");
403+
KeyguardManager myKM = (KeyguardManager) mContext.getSystemService(Context.KEYGUARD_SERVICE);
404+
if( myKM.inKeyguardRestrictedInputMode()&&noLockedOff) {
405+
log("Is at lockscreen & shutdown protection is on. Replacing onPress");
406+
407+
mAirplaneActionHook = XposedHelpers.findAndHookMethod(airplaneActionItem.getClass(),
408+
"onPress", new XC_MethodReplacement () {
409+
@Override
410+
protected Object replaceHookedMethod(MethodHookParam param) throws Throwable {
411+
showLockedDialog();
412+
return null;
413+
}
414+
});
415+
}
416+
} else {
417+
log("Existing airplane action item NOT found!");
418+
}
419+
*/
390420
}
391421
});
392422
} catch (Exception e) {

0 commit comments

Comments
 (0)