Dump PlatformCompat overrides to dumpsys
Dump info related to compat flags. Test: adb shell am compat enable 42 foo.bar; \ dumpsys platform_compat Bug: 137183175 Change-Id: Ic429731a3364dab5902caeb12f48fecf2e49bb65 Merged-In: Ic429731a3364dab5902caeb12f48fecf2e49bb65
This commit is contained in:
committed by
Andrei-Valentin Onea
parent
df301b8887
commit
ccb9130c45
@@ -24,6 +24,7 @@ import android.util.LongSparseArray;
|
||||
import com.android.internal.annotations.GuardedBy;
|
||||
import com.android.internal.annotations.VisibleForTesting;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
/**
|
||||
* This class maintains state relating to platform compatibility changes.
|
||||
*
|
||||
@@ -169,4 +170,22 @@ public final class CompatConfig {
|
||||
return overrideExists;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dumps the current list of compatibility config information.
|
||||
*
|
||||
* @param pw The {@link PrintWriter} instance to which the information will be dumped.
|
||||
*/
|
||||
public void dumpConfig(PrintWriter pw) {
|
||||
synchronized (mChanges) {
|
||||
if (mChanges.size() == 0) {
|
||||
pw.println("No compat overrides.");
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < mChanges.size(); ++i) {
|
||||
CompatChange c = mChanges.valueAt(i);
|
||||
pw.println(c.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -56,6 +56,6 @@ public class PlatformCompat extends IPlatformCompat.Stub {
|
||||
@Override
|
||||
protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
|
||||
if (!DumpUtils.checkDumpAndUsageStatsPermission(mContext, "platform_compat", pw)) return;
|
||||
// TODO: Dump info about compatibility changes.
|
||||
CompatConfig.get().dumpConfig(pw);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user