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) {
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user