Merge "Add Binder.clearCallingIdentity to TracingServiceProxy"
This commit is contained in:
@@ -20,6 +20,7 @@ import android.content.Intent;
|
|||||||
import android.content.pm.PackageInfo;
|
import android.content.pm.PackageInfo;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.content.pm.PackageManager.NameNotFoundException;
|
import android.content.pm.PackageManager.NameNotFoundException;
|
||||||
|
import android.os.Binder;
|
||||||
import android.os.UserHandle;
|
import android.os.UserHandle;
|
||||||
import android.tracing.ITracingServiceProxy;
|
import android.tracing.ITracingServiceProxy;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
@@ -30,6 +31,8 @@ import com.android.server.SystemService;
|
|||||||
* TracingServiceProxy is the system_server intermediary between the Perfetto tracing daemon and the
|
* TracingServiceProxy is the system_server intermediary between the Perfetto tracing daemon and the
|
||||||
* system tracing app Traceur.
|
* system tracing app Traceur.
|
||||||
*
|
*
|
||||||
|
* Access to this service is restricted via SELinux. Normal apps do not have access.
|
||||||
|
*
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public class TracingServiceProxy extends SystemService {
|
public class TracingServiceProxy extends SystemService {
|
||||||
@@ -87,11 +90,15 @@ public class TracingServiceProxy extends SystemService {
|
|||||||
intent.setAction(INTENT_ACTION_NOTIFY_SESSION_STOPPED);
|
intent.setAction(INTENT_ACTION_NOTIFY_SESSION_STOPPED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final long identity = Binder.clearCallingIdentity();
|
||||||
try {
|
try {
|
||||||
mContext.startForegroundServiceAsUser(intent, UserHandle.SYSTEM);
|
mContext.startForegroundServiceAsUser(intent, UserHandle.SYSTEM);
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
Log.e(TAG, "Failed to notifyTraceSessionEnded", e);
|
Log.e(TAG, "Failed to notifyTraceSessionEnded", e);
|
||||||
|
} finally {
|
||||||
|
Binder.restoreCallingIdentity(identity);
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (NameNotFoundException e) {
|
} catch (NameNotFoundException e) {
|
||||||
Log.e(TAG, "Failed to locate Traceur", e);
|
Log.e(TAG, "Failed to locate Traceur", e);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user