Initial commit
This commit is contained in:
145
sources/com/yanzhenjie/permission/checker/StrictChecker.java
Normal file
145
sources/com/yanzhenjie/permission/checker/StrictChecker.java
Normal file
@@ -0,0 +1,145 @@
|
||||
package com.yanzhenjie.permission.checker;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public final class StrictChecker implements PermissionChecker {
|
||||
private static boolean b(Context context) throws Throwable {
|
||||
return new CameraTest(context).a();
|
||||
}
|
||||
|
||||
private static boolean c(Context context) throws Throwable {
|
||||
return new LocationCoarseTest(context).a();
|
||||
}
|
||||
|
||||
private static boolean d(Context context) throws Throwable {
|
||||
return new LocationFineTest(context).a();
|
||||
}
|
||||
|
||||
private static boolean e(Context context) throws Throwable {
|
||||
return new CalendarReadTest(context).a();
|
||||
}
|
||||
|
||||
private static boolean f(Context context) throws Throwable {
|
||||
return new CallLogReadTest(context).a();
|
||||
}
|
||||
|
||||
private static boolean g(Context context) throws Throwable {
|
||||
return new ContactsReadTest(context).a();
|
||||
}
|
||||
|
||||
private static boolean h(Context context) throws Throwable {
|
||||
return new PhoneStateReadTest(context).a();
|
||||
}
|
||||
|
||||
private static boolean i(Context context) throws Throwable {
|
||||
return new SmsReadTest(context).a();
|
||||
}
|
||||
|
||||
private static boolean j(Context context) throws Throwable {
|
||||
return new RecordAudioTest(context).a();
|
||||
}
|
||||
|
||||
private static boolean k(Context context) throws Throwable {
|
||||
return new SensorsTest(context).a();
|
||||
}
|
||||
|
||||
private static boolean l(Context context) throws Throwable {
|
||||
return new SipTest(context).a();
|
||||
}
|
||||
|
||||
private static boolean m(Context context) throws Throwable {
|
||||
return new CalendarWriteTest(context).a();
|
||||
}
|
||||
|
||||
private static boolean n(Context context) throws Throwable {
|
||||
return new CallLogWriteTest(context).a();
|
||||
}
|
||||
|
||||
private static boolean o(Context context) throws Throwable {
|
||||
return new ContactsWriteTest(context.getContentResolver()).a();
|
||||
}
|
||||
|
||||
@Override // com.yanzhenjie.permission.checker.PermissionChecker
|
||||
public boolean a(Context context, String... strArr) {
|
||||
if (Build.VERSION.SDK_INT < 21) {
|
||||
return true;
|
||||
}
|
||||
for (String str : strArr) {
|
||||
if (!a(context, str)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private static boolean b() throws Throwable {
|
||||
return new StorageWriteTest().a();
|
||||
}
|
||||
|
||||
private boolean a(Context context, String str) {
|
||||
try {
|
||||
switch (str) {
|
||||
case "android.permission.READ_CALENDAR":
|
||||
return e(context);
|
||||
case "android.permission.WRITE_CALENDAR":
|
||||
return m(context);
|
||||
case "android.permission.CAMERA":
|
||||
return b(context);
|
||||
case "android.permission.READ_CONTACTS":
|
||||
return g(context);
|
||||
case "android.permission.WRITE_CONTACTS":
|
||||
return o(context);
|
||||
case "android.permission.GET_ACCOUNTS":
|
||||
return true;
|
||||
case "android.permission.ACCESS_COARSE_LOCATION":
|
||||
return c(context);
|
||||
case "android.permission.ACCESS_FINE_LOCATION":
|
||||
return d(context);
|
||||
case "android.permission.RECORD_AUDIO":
|
||||
return j(context);
|
||||
case "android.permission.READ_PHONE_STATE":
|
||||
return h(context);
|
||||
case "android.permission.CALL_PHONE":
|
||||
return true;
|
||||
case "android.permission.READ_CALL_LOG":
|
||||
return f(context);
|
||||
case "android.permission.WRITE_CALL_LOG":
|
||||
return n(context);
|
||||
case "com.android.voicemail.permission.ADD_VOICEMAIL":
|
||||
return a(context);
|
||||
case "android.permission.USE_SIP":
|
||||
return l(context);
|
||||
case "android.permission.PROCESS_OUTGOING_CALLS":
|
||||
return true;
|
||||
case "android.permission.BODY_SENSORS":
|
||||
return k(context);
|
||||
case "android.permission.SEND_SMS":
|
||||
case "android.permission.RECEIVE_MMS":
|
||||
return true;
|
||||
case "android.permission.READ_SMS":
|
||||
return i(context);
|
||||
case "android.permission.RECEIVE_WAP_PUSH":
|
||||
case "android.permission.RECEIVE_SMS":
|
||||
return true;
|
||||
case "android.permission.READ_EXTERNAL_STORAGE":
|
||||
return a();
|
||||
case "android.permission.WRITE_EXTERNAL_STORAGE":
|
||||
return b();
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
} catch (Throwable unused) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean a(Context context) throws Throwable {
|
||||
return new AddVoicemailTest(context).a();
|
||||
}
|
||||
|
||||
private static boolean a() throws Throwable {
|
||||
return new StorageReadTest().a();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user