Merge "Add new TelecomManager method to check if a self-mgd app is in a call." into tm-dev
This commit is contained in:
@@ -2600,6 +2600,33 @@ public class TelecomManager {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determines whether there are any ongoing {@link PhoneAccount#CAPABILITY_SELF_MANAGED}
|
||||||
|
* calls for a given {@code packageName} and {@code userHandle}.
|
||||||
|
*
|
||||||
|
* @param packageName the package name of the app to check calls for.
|
||||||
|
* @param userHandle the user handle on which to check for calls.
|
||||||
|
* @return {@code true} if there are ongoing calls, {@code false} otherwise.
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
@RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
|
||||||
|
public boolean isInSelfManagedCall(@NonNull String packageName,
|
||||||
|
@NonNull UserHandle userHandle) {
|
||||||
|
ITelecomService service = getTelecomService();
|
||||||
|
if (service != null) {
|
||||||
|
try {
|
||||||
|
return service.isInSelfManagedCall(packageName, userHandle,
|
||||||
|
mContext.getOpPackageName());
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
Log.e(TAG, "RemoteException isInSelfManagedCall: " + e);
|
||||||
|
e.rethrowFromSystemServer();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw new IllegalStateException("Telecom service is not present");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles {@link Intent#ACTION_CALL} intents trampolined from UserCallActivity.
|
* Handles {@link Intent#ACTION_CALL} intents trampolined from UserCallActivity.
|
||||||
* @param intent The {@link Intent#ACTION_CALL} intent to handle.
|
* @param intent The {@link Intent#ACTION_CALL} intent to handle.
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import android.telecom.TelecomAnalytics;
|
|||||||
import android.telecom.PhoneAccountHandle;
|
import android.telecom.PhoneAccountHandle;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.os.UserHandle;
|
||||||
import android.telecom.PhoneAccount;
|
import android.telecom.PhoneAccount;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -374,4 +375,10 @@ interface ITelecomService {
|
|||||||
* @see TelecomServiceImpl#setTestCallDiagnosticService
|
* @see TelecomServiceImpl#setTestCallDiagnosticService
|
||||||
*/
|
*/
|
||||||
void setTestCallDiagnosticService(in String packageName);
|
void setTestCallDiagnosticService(in String packageName);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see TelecomServiceImpl#isInSelfManagedCall
|
||||||
|
*/
|
||||||
|
boolean isInSelfManagedCall(String packageName, in UserHandle userHandle,
|
||||||
|
String callingPackage);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user