Loading services/core/java/com/android/server/media/MediaSessionRecord.java +26 −1 Original line number Original line Diff line number Diff line Loading @@ -17,6 +17,8 @@ package com.android.server.media; package com.android.server.media; import android.annotation.Nullable; import android.annotation.Nullable; import android.app.ActivityManager; import android.app.ActivityManagerInternal; import android.app.PendingIntent; import android.app.PendingIntent; import android.content.ComponentName; import android.content.ComponentName; import android.content.Context; import android.content.Context; Loading Loading @@ -55,6 +57,8 @@ import android.util.EventLog; import android.util.Log; import android.util.Log; import android.view.KeyEvent; import android.view.KeyEvent; import com.android.server.LocalServices; import java.io.PrintWriter; import java.io.PrintWriter; import java.util.ArrayList; import java.util.ArrayList; import java.util.Arrays; import java.util.Arrays; Loading Loading @@ -422,6 +426,13 @@ public class MediaSessionRecord implements IBinder.DeathRecipient, MediaSessionR */ */ @Override @Override public void close() { public void close() { // Log the session's active state // to measure usage of foreground service resources int callingUid = Binder.getCallingUid(); int callingPid = Binder.getCallingPid(); LocalServices.getService(ActivityManagerInternal.class) .logFgsApiEnd(ActivityManager.FOREGROUND_SERVICE_API_TYPE_MEDIA_PLAYBACK, callingUid, callingPid); synchronized (mLock) { synchronized (mLock) { if (mDestroyed) { if (mDestroyed) { return; return; Loading Loading @@ -884,8 +895,22 @@ public class MediaSessionRecord implements IBinder.DeathRecipient, MediaSessionR @Override @Override public void setActive(boolean active) throws RemoteException { public void setActive(boolean active) throws RemoteException { // Log the session's active state // to measure usage of foreground service resources int callingUid = Binder.getCallingUid(); int callingPid = Binder.getCallingPid(); if (active) { LocalServices.getService(ActivityManagerInternal.class) .logFgsApiBegin(ActivityManager.FOREGROUND_SERVICE_API_TYPE_MEDIA_PLAYBACK, callingUid, callingPid); } else { LocalServices.getService(ActivityManagerInternal.class) .logFgsApiEnd(ActivityManager.FOREGROUND_SERVICE_API_TYPE_MEDIA_PLAYBACK, callingUid, callingPid); } mIsActive = active; mIsActive = active; final long token = Binder.clearCallingIdentity(); long token = Binder.clearCallingIdentity(); try { try { mService.onSessionActiveStateChanged(MediaSessionRecord.this); mService.onSessionActiveStateChanged(MediaSessionRecord.this); } finally { } finally { Loading Loading
services/core/java/com/android/server/media/MediaSessionRecord.java +26 −1 Original line number Original line Diff line number Diff line Loading @@ -17,6 +17,8 @@ package com.android.server.media; package com.android.server.media; import android.annotation.Nullable; import android.annotation.Nullable; import android.app.ActivityManager; import android.app.ActivityManagerInternal; import android.app.PendingIntent; import android.app.PendingIntent; import android.content.ComponentName; import android.content.ComponentName; import android.content.Context; import android.content.Context; Loading Loading @@ -55,6 +57,8 @@ import android.util.EventLog; import android.util.Log; import android.util.Log; import android.view.KeyEvent; import android.view.KeyEvent; import com.android.server.LocalServices; import java.io.PrintWriter; import java.io.PrintWriter; import java.util.ArrayList; import java.util.ArrayList; import java.util.Arrays; import java.util.Arrays; Loading Loading @@ -422,6 +426,13 @@ public class MediaSessionRecord implements IBinder.DeathRecipient, MediaSessionR */ */ @Override @Override public void close() { public void close() { // Log the session's active state // to measure usage of foreground service resources int callingUid = Binder.getCallingUid(); int callingPid = Binder.getCallingPid(); LocalServices.getService(ActivityManagerInternal.class) .logFgsApiEnd(ActivityManager.FOREGROUND_SERVICE_API_TYPE_MEDIA_PLAYBACK, callingUid, callingPid); synchronized (mLock) { synchronized (mLock) { if (mDestroyed) { if (mDestroyed) { return; return; Loading Loading @@ -884,8 +895,22 @@ public class MediaSessionRecord implements IBinder.DeathRecipient, MediaSessionR @Override @Override public void setActive(boolean active) throws RemoteException { public void setActive(boolean active) throws RemoteException { // Log the session's active state // to measure usage of foreground service resources int callingUid = Binder.getCallingUid(); int callingPid = Binder.getCallingPid(); if (active) { LocalServices.getService(ActivityManagerInternal.class) .logFgsApiBegin(ActivityManager.FOREGROUND_SERVICE_API_TYPE_MEDIA_PLAYBACK, callingUid, callingPid); } else { LocalServices.getService(ActivityManagerInternal.class) .logFgsApiEnd(ActivityManager.FOREGROUND_SERVICE_API_TYPE_MEDIA_PLAYBACK, callingUid, callingPid); } mIsActive = active; mIsActive = active; final long token = Binder.clearCallingIdentity(); long token = Binder.clearCallingIdentity(); try { try { mService.onSessionActiveStateChanged(MediaSessionRecord.this); mService.onSessionActiveStateChanged(MediaSessionRecord.this); } finally { } finally { Loading