use of android.compat.annotation.UnsupportedAppUsage in project android_frameworks_opt_telephony by LineageOS.
the class InboundSmsHandler method dispatchIntent.
/**
* Dispatch the intent with the specified permission, appOp, and result receiver, using
* this state machine's handler thread to run the result receiver.
*
* @param intent the intent to broadcast
* @param permission receivers are required to have this permission
* @param appOp app op that is being performed when dispatching to a receiver
* @param user user to deliver the intent to
*/
@UnsupportedAppUsage
public void dispatchIntent(Intent intent, String permission, String appOp, Bundle opts, BroadcastReceiver resultReceiver, UserHandle user, int subId) {
intent.addFlags(Intent.FLAG_RECEIVER_NO_ABORT);
final String action = intent.getAction();
SubscriptionManager.putPhoneIdAndSubIdExtra(intent, mPhone.getPhoneId());
// different, specifically if the message is coming from SmsBroadcastUndelivered
if (SubscriptionManager.isValidSubscriptionId(subId)) {
SubscriptionManager.putSubscriptionIdExtra(intent, subId);
}
if (user.equals(UserHandle.ALL)) {
// Get a list of currently started users.
int[] users = null;
final List<UserHandle> userHandles = mUserManager.getUserHandles(false);
final List<UserHandle> runningUserHandles = new ArrayList();
for (UserHandle handle : userHandles) {
if (mUserManager.isUserRunning(handle)) {
runningUserHandles.add(handle);
}
}
if (runningUserHandles.isEmpty()) {
users = new int[] { user.getIdentifier() };
} else {
users = new int[runningUserHandles.size()];
for (int i = 0; i < runningUserHandles.size(); i++) {
users[i] = runningUserHandles.get(i).getIdentifier();
}
}
// by user policy.
for (int i = users.length - 1; i >= 0; i--) {
UserHandle targetUser = UserHandle.of(users[i]);
if (users[i] != UserHandle.SYSTEM.getIdentifier()) {
// Is the user not allowed to use SMS?
if (hasUserRestriction(UserManager.DISALLOW_SMS, targetUser)) {
continue;
}
// Skip unknown users and managed profiles as well
if (mUserManager.isManagedProfile(users[i])) {
continue;
}
}
// Only pass in the resultReceiver when the user SYSTEM is processed.
try {
mContext.createPackageContextAsUser(mContext.getPackageName(), 0, targetUser).sendOrderedBroadcast(intent, Activity.RESULT_OK, permission, appOp, users[i] == UserHandle.SYSTEM.getIdentifier() ? resultReceiver : null, getHandler(), null, /* initialData */
null, /* initialExtras */
opts);
} catch (PackageManager.NameNotFoundException ignored) {
}
}
} else {
try {
mContext.createPackageContextAsUser(mContext.getPackageName(), 0, user).sendOrderedBroadcast(intent, Activity.RESULT_OK, permission, appOp, resultReceiver, getHandler(), null, /* initialData */
null, /* initialExtras */
opts);
} catch (PackageManager.NameNotFoundException ignored) {
}
}
}
use of android.compat.annotation.UnsupportedAppUsage in project android_frameworks_opt_telephony by LineageOS.
the class RIL method acquireWakeLock.
/**
* Holds a PARTIAL_WAKE_LOCK whenever
* a) There is outstanding RIL request sent to RIL deamon and no replied
* b) There is a request pending to be sent out.
*
* There is a WAKE_LOCK_TIMEOUT to release the lock, though it shouldn't
* happen often.
*/
@UnsupportedAppUsage
private void acquireWakeLock(RILRequest rr, int wakeLockType) {
synchronized (rr) {
if (rr.mWakeLockType != INVALID_WAKELOCK) {
Rlog.d(RILJ_LOG_TAG, "Failed to aquire wakelock for " + rr.serialString());
return;
}
switch(wakeLockType) {
case FOR_WAKELOCK:
synchronized (mWakeLock) {
mWakeLock.acquire();
mWakeLockCount++;
mWlSequenceNum++;
String clientId = rr.getWorkSourceClientId();
if (!mClientWakelockTracker.isClientActive(clientId)) {
mActiveWakelockWorkSource.add(rr.mWorkSource);
mWakeLock.setWorkSource(mActiveWakelockWorkSource);
}
mClientWakelockTracker.startTracking(rr.mClientId, rr.mRequest, rr.mSerial, mWakeLockCount);
Message msg = mRilHandler.obtainMessage(EVENT_WAKE_LOCK_TIMEOUT);
msg.arg1 = mWlSequenceNum;
mRilHandler.sendMessageDelayed(msg, mWakeLockTimeout);
}
break;
case FOR_ACK_WAKELOCK:
synchronized (mAckWakeLock) {
mAckWakeLock.acquire();
mAckWlSequenceNum++;
Message msg = mRilHandler.obtainMessage(EVENT_ACK_WAKE_LOCK_TIMEOUT);
msg.arg1 = mAckWlSequenceNum;
mRilHandler.sendMessageDelayed(msg, mAckWakeLockTimeout);
}
break;
default:
// WTF
Rlog.w(RILJ_LOG_TAG, "Acquiring Invalid Wakelock type " + wakeLockType);
return;
}
rr.mWakeLockType = wakeLockType;
}
}
use of android.compat.annotation.UnsupportedAppUsage in project android_frameworks_opt_telephony by LineageOS.
the class Phone method setNetworkSelectionModeAutomatic.
/**
* Switches network selection mode to "automatic", re-scanning and
* re-selecting a network if appropriate.
*
* @param response The message to dispatch when the network selection
* is complete.
*
* @see #selectNetworkManually(OperatorInfo, boolean, android.os.Message)
*/
@UnsupportedAppUsage
public void setNetworkSelectionModeAutomatic(Message response) {
Rlog.d(LOG_TAG, "setNetworkSelectionModeAutomatic, querying current mode");
// we don't want to do this unecesarily - it acutally causes
// the radio to repeate network selection and is costly
// first check if we're already in automatic mode
Message msg = obtainMessage(EVENT_CHECK_FOR_NETWORK_AUTOMATIC);
msg.obj = response;
mCi.getNetworkSelectionMode(msg);
}
use of android.compat.annotation.UnsupportedAppUsage in project android_frameworks_opt_telephony by LineageOS.
the class Phone method getActiveApnTypes.
/**
* Returns an array of string identifiers for the APN types serviced by the
* currently active subscription.
*
* @return The string array of APN types. Return null if no active APN types.
*/
@UnsupportedAppUsage
@NonNull
public String[] getActiveApnTypes() {
if (mTransportManager == null || mDcTrackers == null) {
Rlog.e(LOG_TAG, "Invalid state for Transport/DcTrackers");
return new String[0];
}
Set<String> activeApnTypes = new HashSet<String>();
for (int transportType : mTransportManager.getAvailableTransports()) {
DcTracker dct = getDcTracker(transportType);
// TODO: should this ever happen?
if (dct == null)
continue;
activeApnTypes.addAll(Arrays.asList(dct.getActiveApnTypes()));
}
return activeApnTypes.toArray(new String[activeApnTypes.size()]);
}
use of android.compat.annotation.UnsupportedAppUsage in project android_frameworks_opt_telephony by LineageOS.
the class ImsPhoneCallTracker method setVideoCallProvider.
@UnsupportedAppUsage
private void setVideoCallProvider(ImsPhoneConnection conn, ImsCall imsCall) throws RemoteException {
IImsVideoCallProvider imsVideoCallProvider = imsCall.getCallSession().getVideoCallProvider();
if (imsVideoCallProvider != null) {
// TODO: Remove this when we can better formalize the format of session modify requests.
boolean useVideoPauseWorkaround = mPhone.getContext().getResources().getBoolean(com.android.internal.R.bool.config_useVideoPauseWorkaround);
ImsVideoCallProviderWrapper imsVideoCallProviderWrapper = new ImsVideoCallProviderWrapper(imsVideoCallProvider);
if (useVideoPauseWorkaround) {
imsVideoCallProviderWrapper.setUseVideoPauseWorkaround(useVideoPauseWorkaround);
}
conn.setVideoProvider(imsVideoCallProviderWrapper);
imsVideoCallProviderWrapper.registerForDataUsageUpdate(this, EVENT_VT_DATA_USAGE_UPDATE, imsCall);
imsVideoCallProviderWrapper.addImsVideoProviderCallback(conn);
}
}
Aggregations