RingtonePlayerpublic 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 |
Methods Summary |
---|
public void | dump(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.Context | getContextForUser(android.os.UserHandle user)
try {
return mContext.createPackageContextAsUser(mContext.getPackageName(), 0, user);
} catch (NameNotFoundException e) {
throw new RuntimeException(e);
}
| public void | start()
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);
}
|
|