use of android.annotation.SystemApi in project platform_frameworks_base by android.
the class NotificationListenerService method registerAsSystemService.
/**
* Directly register this service with the Notification Manager.
*
* <p>Only system services may use this call. It will fail for non-system callers.
* Apps should ask the user to add their listener in Settings.
*
* @param context Context required for accessing resources. Since this service isn't
* launched as a real Service when using this method, a context has to be passed in.
* @param componentName the component that will consume the notification information
* @param currentUser the user to use as the stream filter
* @hide
*/
@SystemApi
public void registerAsSystemService(Context context, ComponentName componentName, int currentUser) throws RemoteException {
if (mWrapper == null) {
mWrapper = new NotificationListenerWrapper();
}
mSystemContext = context;
INotificationManager noMan = getNotificationInterface();
mHandler = new MyHandler(context.getMainLooper());
mCurrentUser = currentUser;
noMan.registerListener(mWrapper, componentName, currentUser);
}
use of android.annotation.SystemApi in project platform_frameworks_base by android.
the class NotificationListenerService method unregisterAsSystemService.
/**
* Directly unregister this service from the Notification Manager.
*
* <p>This method will fail for listeners that were not registered
* with (@link registerAsService).
* @hide
*/
@SystemApi
public void unregisterAsSystemService() throws RemoteException {
if (mWrapper != null) {
INotificationManager noMan = getNotificationInterface();
noMan.unregisterListener(mWrapper, mCurrentUser);
}
}
use of android.annotation.SystemApi in project platform_frameworks_base by android.
the class TelecomManager method dumpAnalytics.
/**
* Dumps telecom analytics for uploading.
*
* @return
* @hide
*/
@SystemApi
@RequiresPermission(Manifest.permission.DUMP)
public TelecomAnalytics dumpAnalytics() {
ITelecomService service = getTelecomService();
TelecomAnalytics result = null;
if (service != null) {
try {
result = service.dumpCallAnalytics();
} catch (RemoteException e) {
Log.e(TAG, "Error dumping call analytics", e);
}
}
return result;
}
use of android.annotation.SystemApi in project platform_frameworks_base by android.
the class TelephonyManager method setDataEnabled.
/** @hide */
@SystemApi
public void setDataEnabled(int subId, boolean enable) {
try {
Log.d(TAG, "setDataEnabled: enabled=" + enable);
ITelephony telephony = getITelephony();
if (telephony != null)
telephony.setDataEnabled(subId, enable);
} catch (RemoteException e) {
Log.e(TAG, "Error calling ITelephony#setDataEnabled", e);
}
}
use of android.annotation.SystemApi in project android_frameworks_base by DirtyUnicorns.
the class AbstractAccountAuthenticator method startUpdateCredentialsSession.
/**
* Asks user to re-authenticate for an account but defers updating the
* locally stored credentials. No file I/O should be performed in this call.
* Local credentials should be updated only when {@link #finishSession} is
* called after this.
* <p>
* Note: when overriding this method, {@link #finishSession} should be
* overridden too.
* </p>
*
* @param response to send the result back to the AccountManager, will never
* be null
* @param account the account whose credentials are to be updated, will
* never be null
* @param authTokenType the type of auth token to retrieve after updating
* the credentials, may be null
* @param options a Bundle of authenticator-specific options, may be null
* @return a Bundle result or null if the result is to be returned via the
* response. The result will contain either:
* <ul>
* <li>{@link AccountManager#KEY_INTENT}, or
* <li>{@link AccountManager#KEY_ACCOUNT_SESSION_BUNDLE} for
* updating the locally stored credentials later, and if account is
* re-authenticated, optional {@link AccountManager#KEY_PASSWORD}
* and {@link AccountManager#KEY_ACCOUNT_STATUS_TOKEN} for checking
* the status of the account later, or
* <li>{@link AccountManager#KEY_ERROR_CODE} and
* {@link AccountManager#KEY_ERROR_MESSAGE} to indicate an error
* </ul>
* @throws NetworkErrorException if the authenticator could not honor the
* request due to a network error
* @see #finishSession(AccountAuthenticatorResponse, String, Bundle)
* @hide
*/
@SystemApi
public Bundle startUpdateCredentialsSession(final AccountAuthenticatorResponse response, final Account account, final String authTokenType, final Bundle options) throws NetworkErrorException {
new Thread(new Runnable() {
@Override
public void run() {
Bundle sessionBundle = new Bundle();
sessionBundle.putString(KEY_AUTH_TOKEN_TYPE, authTokenType);
sessionBundle.putParcelable(KEY_ACCOUNT, account);
sessionBundle.putBundle(KEY_OPTIONS, options);
Bundle result = new Bundle();
result.putBundle(AccountManager.KEY_ACCOUNT_SESSION_BUNDLE, sessionBundle);
response.onResult(result);
}
}).start();
return null;
}
Aggregations