FileDocCategorySizeDatePackage
RingtonePlayer.javaAPI DocAndroid 5.1 API6081Thu Mar 12 22:22:42 GMT 2015com.android.systemui.media

RingtonePlayer

public class RingtonePlayer extends com.android.systemui.SystemUI
Service that offers to play ringtones by {@link Uri}, since our process has {@link android.Manifest.permission#READ_EXTERNAL_STORAGE}.

Fields Summary
private static final String
TAG
private static final boolean
LOGD
private android.media.IAudioService
mAudioService
private final NotificationPlayer
mAsyncPlayer
private final HashMap
mClients
private android.media.IRingtonePlayer
mCallback
Constructors Summary
Methods Summary
public voiddump(java.io.FileDescriptor fd, java.io.PrintWriter pw, java.lang.String[] args)

        pw.println("Clients:");
        synchronized (mClients) {
            for (Client client : mClients.values()) {
                pw.print("  mToken=");
                pw.print(client.mToken);
                pw.print(" mUri=");
                pw.println(client.mRingtone.getUri());
            }
        }
    
private android.content.ContextgetContextForUser(android.os.UserHandle user)


        
        try {
            return mContext.createPackageContextAsUser(mContext.getPackageName(), 0, user);
        } catch (NameNotFoundException e) {
            throw new RuntimeException(e);
        }
    
public voidstart()


    
       
        mAsyncPlayer.setUsesWakeLock(mContext);

        mAudioService = IAudioService.Stub.asInterface(
                ServiceManager.getService(Context.AUDIO_SERVICE));
        try {
            mAudioService.setRingtonePlayer(mCallback);
        } catch (RemoteException e) {
            Log.e(TAG, "Problem registering RingtonePlayer: " + e);
        }