Merge "Protect system services with DUMP permission." into jb-dev
This commit is contained in:
@@ -588,6 +588,8 @@ public class BluetoothA2dpService extends IBluetoothA2dp.Stub {
|
||||
|
||||
@Override
|
||||
protected synchronized void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
|
||||
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.DUMP, TAG);
|
||||
|
||||
if (mAudioDevices.isEmpty()) return;
|
||||
pw.println("Cached audio devices:");
|
||||
for (BluetoothDevice device : mAudioDevices.keySet()) {
|
||||
|
||||
@@ -1775,6 +1775,8 @@ public class BluetoothService extends IBluetooth.Stub {
|
||||
|
||||
@Override
|
||||
protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
|
||||
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.DUMP, TAG);
|
||||
|
||||
if (getBluetoothStateInternal() != BluetoothAdapter.STATE_ON) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -169,6 +169,8 @@ public class DreamManagerService
|
||||
|
||||
@Override
|
||||
protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
|
||||
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.DUMP, TAG);
|
||||
|
||||
pw.println("Dreamland:");
|
||||
pw.print(" component="); pw.println(mCurrentDreamComponent);
|
||||
pw.print(" token="); pw.println(mCurrentDreamToken);
|
||||
|
||||
@@ -4232,6 +4232,8 @@ public class AudioService extends IAudioService.Stub {
|
||||
|
||||
@Override
|
||||
protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
|
||||
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.DUMP, TAG);
|
||||
|
||||
// TODO probably a lot more to do here than just the audio focus and remote control stacks
|
||||
dumpFocusStack(pw);
|
||||
dumpRCStack(pw);
|
||||
|
||||
@@ -111,14 +111,6 @@ public class SystemUIService extends Service {
|
||||
|
||||
@Override
|
||||
protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
|
||||
if (checkCallingOrSelfPermission(android.Manifest.permission.DUMP)
|
||||
!= PackageManager.PERMISSION_GRANTED) {
|
||||
pw.println("Permission Denial: can't dump StatusBar from from pid="
|
||||
+ Binder.getCallingPid()
|
||||
+ ", uid=" + Binder.getCallingUid());
|
||||
return;
|
||||
}
|
||||
|
||||
if (args == null || args.length == 0) {
|
||||
for (SystemUI ui: mServices) {
|
||||
pw.println("dumping service: " + ui.getClass().getName());
|
||||
|
||||
@@ -5714,6 +5714,8 @@ class BackupManagerService extends IBackupManager.Stub {
|
||||
|
||||
@Override
|
||||
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
|
||||
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.DUMP, TAG);
|
||||
|
||||
long identityToken = Binder.clearCallingIdentity();
|
||||
try {
|
||||
dumpInternal(pw);
|
||||
@@ -5723,16 +5725,6 @@ class BackupManagerService extends IBackupManager.Stub {
|
||||
}
|
||||
|
||||
private void dumpInternal(PrintWriter pw) {
|
||||
if (mContext.checkCallingOrSelfPermission(android.Manifest.permission.DUMP)
|
||||
!= PackageManager.PERMISSION_GRANTED) {
|
||||
pw.println("Permission Denial: can't dump Backup Manager service from from pid="
|
||||
+ Binder.getCallingPid()
|
||||
+ ", uid=" + Binder.getCallingUid()
|
||||
+ " without permission "
|
||||
+ android.Manifest.permission.DUMP);
|
||||
return;
|
||||
}
|
||||
|
||||
synchronized (mQueueLock) {
|
||||
pw.println("Backup Manager is " + (mEnabled ? "enabled" : "disabled")
|
||||
+ " / " + (!mProvisioned ? "not " : "") + "provisioned / "
|
||||
|
||||
@@ -212,6 +212,8 @@ public class CountryDetectorService extends ICountryDetector.Stub implements Run
|
||||
@SuppressWarnings("unused")
|
||||
@Override
|
||||
protected void dump(FileDescriptor fd, PrintWriter fout, String[] args) {
|
||||
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.DUMP, TAG);
|
||||
|
||||
if (!DEBUG) return;
|
||||
try {
|
||||
final Printer p = new PrintWriterPrinter(fout);
|
||||
|
||||
@@ -34,6 +34,8 @@ import java.io.PrintWriter;
|
||||
* statistics about the status of the disk.
|
||||
*/
|
||||
public class DiskStatsService extends Binder {
|
||||
private static final String TAG = "DiskStatsService";
|
||||
|
||||
private final Context mContext;
|
||||
|
||||
public DiskStatsService(Context context) {
|
||||
@@ -42,7 +44,7 @@ public class DiskStatsService extends Binder {
|
||||
|
||||
@Override
|
||||
protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
|
||||
// This data is accessible to any app -- no permission check needed.
|
||||
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.DUMP, TAG);
|
||||
|
||||
// Run a quick-and-dirty performance test: write 512 bytes
|
||||
byte[] junk = new byte[512];
|
||||
|
||||
@@ -39,9 +39,11 @@ public class SamplingProfilerService extends Binder {
|
||||
private static final boolean LOCAL_LOGV = false;
|
||||
public static final String SNAPSHOT_DIR = SamplingProfilerIntegration.SNAPSHOT_DIR;
|
||||
|
||||
private final Context mContext;
|
||||
private FileObserver snapshotObserver;
|
||||
|
||||
public SamplingProfilerService(Context context) {
|
||||
mContext = context;
|
||||
registerSettingObserver(context);
|
||||
startWorking(context);
|
||||
}
|
||||
@@ -94,6 +96,8 @@ public class SamplingProfilerService extends Binder {
|
||||
|
||||
@Override
|
||||
protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
|
||||
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.DUMP, TAG);
|
||||
|
||||
pw.println("SamplingProfilerService:");
|
||||
pw.println("Watching directory: " + SNAPSHOT_DIR);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user