Skip to content

Commit

Permalink
v6.03: Fixed a problem with factory reset on Android 14
Browse files Browse the repository at this point in the history
  • Loading branch information
vmayorow committed Sep 16, 2024
1 parent c42486d commit 1dbfea0
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ android {
// To avoid extra step during initial setup, let's keep the target SDK version as 29 as long as possible
//noinspection ExpiredTargetSdkVersion
targetSdkVersion 34
versionCode 15020
versionName "6.02"
versionCode 15030
versionName "6.03"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
dataBinding {
enabled = true
Expand Down
38 changes: 38 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,44 @@
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_LOCATION" />
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM" />
<uses-permission android:name="android.permission.REQUEST_PASSWORD_COMPLEXITY" />
<uses-permission android:name="android.permission.MASTER_CLEAR"
tools:ignore="ProtectedPermissions"/>

<uses-permission android:name="android.permission.MANAGE_DEVICE_POLICY_AIRPLANE_MODE" />
<uses-permission android:name="android.permission.MANAGE_DEVICE_POLICY_APPS_CONTROL" />
<uses-permission android:name="android.permission.MANAGE_DEVICE_POLICY_AUDIO_OUTPUT" />
<uses-permission android:name="android.permission.MANAGE_DEVICE_POLICY_BLUETOOTH" />
<uses-permission android:name="android.permission.MANAGE_DEVICE_POLICY_CALLS" />
<uses-permission android:name="android.permission.MANAGE_DEVICE_POLICY_CERTIFICATES" />
<uses-permission android:name="android.permission.MANAGE_DEVICE_POLICY_DEBUGGING_FEATURES" />
<uses-permission android:name="android.permission.MANAGE_DEVICE_POLICY_DISPLAY" />
<uses-permission android:name="android.permission.MANAGE_DEVICE_POLICY_FACTORY_RESET" />
<uses-permission android:name="android.permission.MANAGE_DEVICE_POLICY_FUN" />
<uses-permission android:name="android.permission.MANAGE_DEVICE_POLICY_INSTALL_UNKNOWN_SOURCES" />
<uses-permission android:name="android.permission.MANAGE_DEVICE_POLICY_LOCALE" />
<uses-permission android:name="android.permission.MANAGE_DEVICE_POLICY_LOCATION" />
<uses-permission android:name="android.permission.MANAGE_DEVICE_POLICY_LOCK_CREDENTIALS" />
<uses-permission android:name="android.permission.MANAGE_DEVICE_POLICY_MICROPHONE" />
<uses-permission android:name="android.permission.MANAGE_DEVICE_POLICY_MOBILE_NETWORK" />
<uses-permission android:name="android.permission.MANAGE_DEVICE_POLICY_MODIFY_USERS" />
<uses-permission android:name="android.permission.MANAGE_DEVICE_POLICY_NEARBY_COMMUNICATION" />
<uses-permission android:name="android.permission.MANAGE_DEVICE_POLICY_PHYSICAL_MEDIA" />
<uses-permission android:name="android.permission.MANAGE_DEVICE_POLICY_PRINTING" />
<uses-permission android:name="android.permission.MANAGE_DEVICE_POLICY_RESET_PASSWORD" />
<uses-permission android:name="android.permission.MANAGE_DEVICE_POLICY_RESTRICT_PRIVATE_DNS" />
<uses-permission android:name="android.permission.MANAGE_DEVICE_POLICY_SAFE_BOOT" />
<uses-permission android:name="android.permission.MANAGE_DEVICE_POLICY_SCREEN_CONTENT" />
<uses-permission android:name="android.permission.MANAGE_DEVICE_POLICY_SMS" />
<uses-permission android:name="android.permission.MANAGE_DEVICE_POLICY_SYSTEM_UPDATES" />
<uses-permission android:name="android.permission.MANAGE_DEVICE_POLICY_SYSTEM_DIALOGS" />
<uses-permission android:name="android.permission.MANAGE_DEVICE_POLICY_TIME" />
<uses-permission android:name="android.permission.MANAGE_DEVICE_POLICY_USB_FILE_TRANSFER" />
<uses-permission android:name="android.permission.MANAGE_DEVICE_POLICY_VPN" />
<uses-permission android:name="android.permission.MANAGE_DEVICE_POLICY_WALLPAPER" />
<uses-permission android:name="android.permission.MANAGE_DEVICE_POLICY_WIFI" />
<uses-permission android:name="android.permission.MANAGE_DEVICE_POLICY_WINDOWS" />
<uses-permission android:name="android.permission.MANAGE_DEVICE_POLICY_WIPE_DATA" />

<uses-sdk tools:overrideLibrary="com.google.zxing.client.android" />

Expand Down
6 changes: 5 additions & 1 deletion app/src/main/java/com/hmdm/launcher/util/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,11 @@ public static boolean checkAdminMode(Context context) {
public static boolean factoryReset(Context context) {
try {
DevicePolicyManager dpm = (DevicePolicyManager) context.getSystemService(Context.DEVICE_POLICY_SERVICE);
dpm.wipeData(0);
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
dpm.wipeData(0);
} else {
dpm.wipeDevice(0);
}
return true;
} catch (Exception e) {
return false;
Expand Down

0 comments on commit 1dbfea0

Please sign in to comment.