diff options
Diffstat (limited to 'core/java')
-rw-r--r-- | core/java/android/app/ActivityThread.java | 9 | ||||
-rw-r--r-- | core/java/android/app/ApplicationThreadNative.java | 29 | ||||
-rw-r--r-- | core/java/android/app/IApplicationThread.java | 2 | ||||
-rw-r--r-- | core/java/android/database/sqlite/SQLiteDebug.java | 8 |
4 files changed, 48 insertions, 0 deletions
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java index 9e88bc6..bac3c6c 100644 --- a/core/java/android/app/ActivityThread.java +++ b/core/java/android/app/ActivityThread.java @@ -65,6 +65,7 @@ import android.util.DisplayMetrics; import android.util.EventLog; import android.util.Log; import android.util.LogPrinter; +import android.util.PrintWriterPrinter; import android.util.Slog; import android.view.Display; import android.view.HardwareRenderer; @@ -1039,6 +1040,14 @@ public final class ActivityThread { WindowManagerImpl.getDefault().dumpGfxInfo(fd); } + @Override + public void dumpDbInfo(FileDescriptor fd, String[] args) { + PrintWriter pw = new PrintWriter(new FileOutputStream(fd)); + PrintWriterPrinter printer = new PrintWriterPrinter(pw); + SQLiteDebug.dump(printer, args); + pw.flush(); + } + private void printRow(PrintWriter pw, String format, Object...objs) { pw.println(String.format(format, objs)); } diff --git a/core/java/android/app/ApplicationThreadNative.java b/core/java/android/app/ApplicationThreadNative.java index e6d28ef..e75d7b4 100644 --- a/core/java/android/app/ApplicationThreadNative.java +++ b/core/java/android/app/ApplicationThreadNative.java @@ -554,6 +554,26 @@ public abstract class ApplicationThreadNative extends Binder reply.writeNoException(); return true; } + + case DUMP_DB_INFO_TRANSACTION: + { + data.enforceInterface(IApplicationThread.descriptor); + ParcelFileDescriptor fd = data.readFileDescriptor(); + String[] args = data.readStringArray(); + if (fd != null) { + try { + dumpDbInfo(fd.getFileDescriptor(), args); + } finally { + try { + fd.close(); + } catch (IOException e) { + // swallowed, not propagated back to the caller + } + } + } + reply.writeNoException(); + return true; + } } return super.onTransact(code, data, reply, flags); @@ -1131,4 +1151,13 @@ class ApplicationThreadProxy implements IApplicationThread { mRemote.transact(DUMP_GFX_INFO_TRANSACTION, data, null, IBinder.FLAG_ONEWAY); data.recycle(); } + + public void dumpDbInfo(FileDescriptor fd, String[] args) throws RemoteException { + Parcel data = Parcel.obtain(); + data.writeInterfaceToken(IApplicationThread.descriptor); + data.writeFileDescriptor(fd); + data.writeStringArray(args); + mRemote.transact(DUMP_DB_INFO_TRANSACTION, data, null, IBinder.FLAG_ONEWAY); + data.recycle(); + } } diff --git a/core/java/android/app/IApplicationThread.java b/core/java/android/app/IApplicationThread.java index a362778..6ad1736 100644 --- a/core/java/android/app/IApplicationThread.java +++ b/core/java/android/app/IApplicationThread.java @@ -127,6 +127,7 @@ public interface IApplicationThread extends IInterface { Debug.MemoryInfo dumpMemInfo(FileDescriptor fd, boolean checkin, boolean all, String[] args) throws RemoteException; void dumpGfxInfo(FileDescriptor fd, String[] args) throws RemoteException; + void dumpDbInfo(FileDescriptor fd, String[] args) throws RemoteException; String descriptor = "android.app.IApplicationThread"; @@ -174,4 +175,5 @@ public interface IApplicationThread extends IInterface { int DUMP_MEM_INFO_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+42; int DUMP_GFX_INFO_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+43; int DUMP_PROVIDER_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+44; + int DUMP_DB_INFO_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+45; } diff --git a/core/java/android/database/sqlite/SQLiteDebug.java b/core/java/android/database/sqlite/SQLiteDebug.java index cc057e0..029bb4a 100644 --- a/core/java/android/database/sqlite/SQLiteDebug.java +++ b/core/java/android/database/sqlite/SQLiteDebug.java @@ -21,6 +21,7 @@ import java.util.ArrayList; import android.os.Build; import android.os.SystemProperties; import android.util.Log; +import android.util.Printer; /** * Provides debugging info about all SQLite databases running in the current process. @@ -181,6 +182,13 @@ public final class SQLiteDebug { } /** + * Dumps detailed information about all databases used by the process. + * @param printer The printer for dumping database state. + */ + public static void dump(Printer printer, String[] args) { + } + + /** * Gathers statistics about all pagers in the current process. */ public static native void getPagerStats(PagerStats stats); |