From 2c749d242759ea36c0229ea933f22b6363337b19 Mon Sep 17 00:00:00 2001 From: Adam Lesinski Date: Wed, 4 Jun 2014 13:00:29 -0700 Subject: New command to get device config Change-Id: I7172a3a150fd83e2382ca3e4e4a0188758189f14 --- cmds/am/src/com/android/commands/am/Am.java | 31 +++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) (limited to 'cmds/am') diff --git a/cmds/am/src/com/android/commands/am/Am.java b/cmds/am/src/com/android/commands/am/Am.java index 8945526..9c1f1d1 100644 --- a/cmds/am/src/com/android/commands/am/Am.java +++ b/cmds/am/src/com/android/commands/am/Am.java @@ -32,6 +32,7 @@ import android.content.IIntentReceiver; import android.content.Intent; import android.content.pm.IPackageManager; import android.content.pm.ResolveInfo; +import android.content.res.Configuration; import android.graphics.Rect; import android.net.Uri; import android.os.Binder; @@ -45,6 +46,8 @@ import android.os.SystemProperties; import android.os.UserHandle; import android.util.AndroidException; import android.view.IWindowManager; +import android.view.View; + import com.android.internal.os.BaseCommand; import dalvik.system.VMRuntime; @@ -123,6 +126,7 @@ public class Am extends BaseCommand { " am stack info \n" + " am lock-task \n" + " am lock-task stop\n" + + " am get-config\n" + "\n" + "am start: start an Activity. Options are:\n" + " -D: enable debugging\n" + @@ -229,6 +233,9 @@ public class Am extends BaseCommand { "\n" + "am lock-task: bring to the front and don't allow other tasks to run\n" + "\n" + + "am get-config: retrieve the configuration and any recent configurations\n" + + " of the device\n" + + "\n" + " specifications include these flags and arguments:\n" + " [-a ] [-d ] [-t ]\n" + " [-c [-c ] ...]\n" + @@ -323,6 +330,8 @@ public class Am extends BaseCommand { runStack(); } else if (op.equals("lock-task")) { runLockTask(); + } else if (op.equals("get-config")) { + runGetConfig(); } else { showError("Error: unknown command '" + op + "'"); } @@ -909,8 +918,7 @@ public class Am extends BaseCommand { } } - if (!mAm.startInstrumentation(cn, profileFile, 0, args, watcher, connection, userId, - abi)) { + if (!mAm.startInstrumentation(cn, profileFile, 0, args, watcher, connection, userId, abi)) { throw new AndroidException("INSTRUMENTATION_FAILED: " + cn.flattenToString()); } @@ -1699,4 +1707,23 @@ public class Am extends BaseCommand { } catch (RemoteException e) { } } + + private void runGetConfig() throws Exception { + try { + Configuration config = mAm.getConfiguration(); + if (config == null) { + System.err.println("Activity manager has no configuration"); + return; + } + + System.out.println("config: " + Configuration.resourceQualifierString(config)); + System.out.print("abi: " + Build.CPU_ABI); + if (!Build.CPU_ABI2.isEmpty()) { + System.out.print("," + Build.CPU_ABI2); + } + System.out.println(); + + } catch (RemoteException e) { + } + } } -- cgit v1.1