Search in sources :

Example 56 with SystemApi

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);
}
Also used : INotificationManager(android.app.INotificationManager) SystemApi(android.annotation.SystemApi)

Example 57 with SystemApi

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);
    }
}
Also used : INotificationManager(android.app.INotificationManager) SystemApi(android.annotation.SystemApi)

Example 58 with SystemApi

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;
}
Also used : ITelecomService(com.android.internal.telecom.ITelecomService) RemoteException(android.os.RemoteException) SystemApi(android.annotation.SystemApi) RequiresPermission(android.annotation.RequiresPermission)

Example 59 with SystemApi

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);
    }
}
Also used : RemoteException(android.os.RemoteException) ITelephony(com.android.internal.telephony.ITelephony) SystemApi(android.annotation.SystemApi)

Example 60 with SystemApi

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;
}
Also used : Bundle(android.os.Bundle) SystemApi(android.annotation.SystemApi)

Aggregations

SystemApi (android.annotation.SystemApi)96 Bundle (android.os.Bundle)36 RemoteException (android.os.RemoteException)33 INotificationManager (android.app.INotificationManager)10 RequiresPermission (android.annotation.RequiresPermission)6 ComponentName (android.content.ComponentName)6 NonNull (android.annotation.NonNull)5 Notification (android.app.Notification)5 AudioFormat (android.media.AudioFormat)5 AudioRecord (android.media.AudioRecord)5 AudioTrack (android.media.AudioTrack)5 Parcel (android.os.Parcel)5 TextPaint (android.text.TextPaint)5 FileWriter (java.io.FileWriter)5 IOException (java.io.IOException)5 ArrayList (java.util.ArrayList)5 ITelecomService (com.android.internal.telecom.ITelecomService)4 ICarrierConfigLoader (com.android.internal.telephony.ICarrierConfigLoader)4 ITelephony (com.android.internal.telephony.ITelephony)4 Implementation (org.robolectric.annotation.Implementation)3