Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6e6e89b38a | ||
|
|
cad2e9df9d | ||
|
|
b803df9685 | ||
|
|
14f525ec80 |
No files matched your search
+5
-1
@@ -7,7 +7,7 @@ android {
|
|||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "com.jens.automation2"
|
applicationId "com.jens.automation2"
|
||||||
minSdkVersion 19
|
minSdkVersion 24
|
||||||
compileSdkVersion 37
|
compileSdkVersion 37
|
||||||
buildToolsVersion '36.0.0'
|
buildToolsVersion '36.0.0'
|
||||||
useLibrary 'org.apache.http.legacy'
|
useLibrary 'org.apache.http.legacy'
|
||||||
@@ -84,4 +84,8 @@ dependencies {
|
|||||||
testImplementation 'junit:junit:4.13.2'
|
testImplementation 'junit:junit:4.13.2'
|
||||||
androidTestImplementation 'androidx.test.ext:junit:1.2.1'
|
androidTestImplementation 'androidx.test.ext:junit:1.2.1'
|
||||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
|
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
|
||||||
|
|
||||||
|
def shizuku_version = "13.1.5"
|
||||||
|
implementation "dev.rikka.shizuku:api:$shizuku_version"
|
||||||
|
implementation "dev.rikka.shizuku:provider:$shizuku_version"
|
||||||
}
|
}
|
||||||
@@ -275,6 +275,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>
|
||||||
|
|||||||
@@ -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()
|
||||||
{
|
{
|
||||||
@@ -273,6 +277,11 @@ public class ActivityPermissions extends Activity
|
|||||||
if (!havePermission(s, context))
|
if (!havePermission(s, context))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
else if(s.equalsIgnoreCase(permissionNameShizuku))
|
||||||
|
{
|
||||||
|
if(!ShizukuAccess.isAuthorized())
|
||||||
|
return true;
|
||||||
|
}
|
||||||
else if (!havePermission(s, context))
|
else if (!havePermission(s, context))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -529,6 +538,7 @@ public class ActivityPermissions extends Activity
|
|||||||
|
|
||||||
if (rule.isRuleActive())
|
if (rule.isRuleActive())
|
||||||
{
|
{
|
||||||
|
addToArrayListUnique(permissionNameShizuku, requiredPermissions);
|
||||||
for (Trigger trigger : rule.getTriggerSet())
|
for (Trigger trigger : rule.getTriggerSet())
|
||||||
{
|
{
|
||||||
switch (trigger.getTriggerType())
|
switch (trigger.getTriggerType())
|
||||||
@@ -1390,6 +1400,11 @@ 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();
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1909,4 +1924,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