Shizuku
This commit is contained in:
1 parent
b803df9685
commit
cad2e9df9d
4 files changed
+57
-1
No files matched your search
@@ -260,6 +260,14 @@
|
|||||||
android:exported="true"
|
android:exported="true"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<provider
|
||||||
|
android:name="rikka.shizuku.ShizukuProvider"
|
||||||
|
android:authorities="${applicationId}.shizuku"
|
||||||
|
android:enabled="true"
|
||||||
|
android:exported="true"
|
||||||
|
android:multiprocess="false"
|
||||||
|
android:permission="android.permission.INTERACT_ACROSS_USERS_FULL" />
|
||||||
|
|
||||||
<service android:name=".MyAccessibilityService"
|
<service android:name=".MyAccessibilityService"
|
||||||
android:permission="android.permission.BIND_ACCESSIBILITY_SERVICE">
|
android:permission="android.permission.BIND_ACCESSIBILITY_SERVICE">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
|
|||||||
@@ -253,13 +253,20 @@
|
|||||||
android:value="@integer/google_play_services_version" />
|
android:value="@integer/google_play_services_version" />
|
||||||
<service android:name=".location.GeofenceIntentService"/>
|
<service android:name=".location.GeofenceIntentService"/>
|
||||||
|
|
||||||
|
|
||||||
<provider
|
<provider
|
||||||
android:name=".FileShareProvider"
|
android:name=".FileShareProvider"
|
||||||
android:authorities="com.jens.automation2"
|
android:authorities="com.jens.automation2"
|
||||||
android:exported="true"
|
android:exported="true"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<provider
|
||||||
|
android:name="rikka.shizuku.ShizukuProvider"
|
||||||
|
android:authorities="${applicationId}.shizuku"
|
||||||
|
android:enabled="true"
|
||||||
|
android:exported="true"
|
||||||
|
android:multiprocess="false"
|
||||||
|
android:permission="android.permission.INTERACT_ACROSS_USERS_FULL" />
|
||||||
|
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
||||||
@@ -39,6 +39,8 @@ import java.util.Iterator;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import rikka.shizuku.Shizuku;
|
||||||
|
|
||||||
public class ActivityPermissions extends Activity
|
public class ActivityPermissions extends Activity
|
||||||
{
|
{
|
||||||
static Map<String, String> mapGeneralPermissions = null;
|
static Map<String, String> mapGeneralPermissions = null;
|
||||||
@@ -58,6 +60,7 @@ public class ActivityPermissions extends Activity
|
|||||||
private static final int requestCodeForPermissionsManageOverlay = 12050;
|
private static final int requestCodeForPermissionsManageOverlay = 12050;
|
||||||
private static final int requestCodeForPermissionsAccessibility = 12051;
|
private static final int requestCodeForPermissionsAccessibility = 12051;
|
||||||
private static final int requestCodeForPermissionsScheduleExactAlarms = 12052;
|
private static final int requestCodeForPermissionsScheduleExactAlarms = 12052;
|
||||||
|
private static final int requestCodeForPermissionsShizuku = 12053;
|
||||||
protected String[] specificPermissionsToRequest = null;
|
protected String[] specificPermissionsToRequest = null;
|
||||||
|
|
||||||
public static String intentExtraName = "permissionsToBeRequested";
|
public static String intentExtraName = "permissionsToBeRequested";
|
||||||
@@ -70,6 +73,7 @@ public class ActivityPermissions extends Activity
|
|||||||
public final static String permissionNameGoogleActivityDetection = "com.google.android.gms.permission.ACTIVITY_RECOGNITION";
|
public final static String permissionNameGoogleActivityDetection = "com.google.android.gms.permission.ACTIVITY_RECOGNITION";
|
||||||
public final static String permissionNameSuperuser = "android.permission.ACCESS_SUPERUSER";
|
public final static String permissionNameSuperuser = "android.permission.ACCESS_SUPERUSER";
|
||||||
public final static String permissionNameProximity = "android.hardware.sensor.proximity";
|
public final static String permissionNameProximity = "android.hardware.sensor.proximity";
|
||||||
|
public final static String permissionNameShizuku = "android_permission_shizuku";
|
||||||
|
|
||||||
public static ActivityPermissions getInstance()
|
public static ActivityPermissions getInstance()
|
||||||
{
|
{
|
||||||
@@ -444,6 +448,8 @@ public class ActivityPermissions extends Activity
|
|||||||
addToArrayListUnique("android.permission.RECEIVE_BOOT_COMPLETED", requiredPermissions);
|
addToArrayListUnique("android.permission.RECEIVE_BOOT_COMPLETED", requiredPermissions);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
addToArrayListUnique(permissionNameShizuku, requiredPermissions);
|
||||||
|
|
||||||
if(!havePermission(Manifest.permission.WRITE_SETTINGS, workingContext))
|
if(!havePermission(Manifest.permission.WRITE_SETTINGS, workingContext))
|
||||||
{
|
{
|
||||||
for (Profile profile : Profile.getProfileCollection())
|
for (Profile profile : Profile.getProfileCollection())
|
||||||
@@ -1390,6 +1396,10 @@ public class ActivityPermissions extends Activity
|
|||||||
Linkify.addLinks((TextView) diaglog.findViewById(android.R.id.message), Linkify.ALL);
|
Linkify.addLinks((TextView) diaglog.findViewById(android.R.id.message), Linkify.ALL);
|
||||||
// return;
|
// return;
|
||||||
}
|
}
|
||||||
|
else if(s.equals(permissionNameShizuku))
|
||||||
|
{
|
||||||
|
ShizukuAccess.requestAuthorization();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1909,4 +1919,34 @@ public class ActivityPermissions extends Activity
|
|||||||
// have all
|
// have all
|
||||||
setHaveAllPermissions();
|
setHaveAllPermissions();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public final static class ShizukuAccess
|
||||||
|
{
|
||||||
|
private ShizukuAccess()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isAvailable()
|
||||||
|
{
|
||||||
|
return !Shizuku.isPreV11() && Shizuku.pingBinder();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isAuthorized()
|
||||||
|
{
|
||||||
|
return isAvailable() && Shizuku.checkSelfPermission() == PackageManager.PERMISSION_GRANTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void requestAuthorization()
|
||||||
|
{
|
||||||
|
if (!isAvailable())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Shizuku.checkSelfPermission() != PackageManager.PERMISSION_GRANTED)
|
||||||
|
{
|
||||||
|
Shizuku.requestPermission(requestCodeForPermissionsShizuku);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -979,4 +979,5 @@
|
|||||||
<string name="examplesWriteSecureSettings">I do not keep a list of possible settings. Please find those settings on your own. See <a href="https://developer.android.com/reference/android/provider/Settings.Secure">here</a> for some (incomplete) examples.</string>
|
<string name="examplesWriteSecureSettings">I do not keep a list of possible settings. Please find those settings on your own. See <a href="https://developer.android.com/reference/android/provider/Settings.Secure">here</a> for some (incomplete) examples.</string>
|
||||||
<string name="httpParametersExplanation">If any parameter name starts with %1$s while method is POST, it will not be transmitted like the other parameters (with key=value), but transferred as main data. If the parameter ends with %2$s, no encoding will be performed.</string>
|
<string name="httpParametersExplanation">If any parameter name starts with %1$s while method is POST, it will not be transmitted like the other parameters (with key=value), but transferred as main data. If the parameter ends with %2$s, no encoding will be performed.</string>
|
||||||
<string name="target">Target</string>
|
<string name="target">Target</string>
|
||||||
|
<string name="android_permission_shizuku" translatable="false">Shizuku</string>
|
||||||
</resources>
|
</resources>
|
||||||
Reference in new issue
Block a user