mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-23 20:48:43 +00:00
Catch possible phone permission exception on specific devices.
This commit is contained in:
@@ -47,9 +47,14 @@ public class TelephonyUtil {
|
||||
}
|
||||
|
||||
public static boolean isAnyPstnLineBusy(@NonNull Context context) {
|
||||
if (ContextCompat.checkSelfPermission(context, Manifest.permission.READ_PHONE_STATE) == PackageManager.PERMISSION_GRANTED) {
|
||||
return getManager(context).getCallState() != TelephonyManager.CALL_STATE_IDLE;
|
||||
} else {
|
||||
try {
|
||||
if (ContextCompat.checkSelfPermission(context, Manifest.permission.READ_PHONE_STATE) == PackageManager.PERMISSION_GRANTED) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user