kopia lustrzana https://github.com/ryukoposting/Signal-Android
Catch possible phone permission exception on specific devices.
rodzic
14a9e22b5e
commit
00e70212c5
|
@ -47,9 +47,14 @@ public class TelephonyUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isAnyPstnLineBusy(@NonNull Context context) {
|
public static boolean isAnyPstnLineBusy(@NonNull Context context) {
|
||||||
if (ContextCompat.checkSelfPermission(context, Manifest.permission.READ_PHONE_STATE) == PackageManager.PERMISSION_GRANTED) {
|
try {
|
||||||
return getManager(context).getCallState() != TelephonyManager.CALL_STATE_IDLE;
|
if (ContextCompat.checkSelfPermission(context, Manifest.permission.READ_PHONE_STATE) == PackageManager.PERMISSION_GRANTED) {
|
||||||
} else {
|
return getManager(context).getCallState() != TelephonyManager.CALL_STATE_IDLE;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} catch (SecurityException e) {
|
||||||
|
Log.w(TAG, "Failed to determine if busy!", e);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue