I have an app installed on the system partition (not signed with the system's signature key) and want to use the shutdown
method of ShutdownThread
. I doing the following:
try {
Class<?> ShutdownThread = Class.forName("com.android.server.pm.ShutdownThread");
Method shutdown = ShutdownThread.getMethod("shutdown", Context.class, boolean.class);
Log.v(getString(R.string.app_name), "PowerService: apagando");
shutdown.invoke(ShutdownThread, getApplicationContext(), false);
} catch (Exception e) {
e.printStackTrace();
}
Log.v(getString(R.string.app_name), "PowerService: deteniendo");
The method get's invoked correctly but during the shutdown()
's execution an error occurrs and I have no idea of how to solve it. Next are the Logcat's messages:
01-16 13:38:46.976: V/My APP (587): PowerService: apagando
01-16 13:38:46.984: D/ShutdownThread(587): !@Notifying thread to start shutdown longPressBehavior=1
01-16 13:38:46.984: I/ShutdownThread(587): !@########POWEROFF START WITHOUT CONFIRM######
01-16 13:38:46.984: I/ShutdownDelay (587): start state
01-16 13:38:46.984: I/ShutdownThread(587): beginShutdownSequence
01-16 13:38:46.984: I/ShutdownThread(587): setStartedShutdown to true
01-16 13:38:46.984: D/InputReader (389): !@setStartedShutdown: 1
01-16 13:38:46.984: D/BatteryStatsImpl(389): ++++++xy WakeLock start : pid=587, name=, type=0, tid=688, pid=389, pName=null
01-16 13:38:46.984: I/AudioSystem (587): AudioSystem::setParameters(shutdown=1)
01-16 13:38:46.984: D/dalvikvm (389): WAIT_FOR_CONCURRENT_GC blocked 0ms
01-16 13:38:46.992: W/ServiceManager(106): Permission failure: android.permission.MODIFY_AUDIO_SETTINGS from uid=10121 pid=587
01-16 13:38:46.992: E/ (106): Request requires android.permission.MODIFY_AUDIO_SETTINGS
01-16 13:38:47.109: D/dalvikvm (389): GC_EXPLICIT freed 609K, 22% free 14194K/18055K, paused 6ms+9ms, total 126ms
01-16 13:38:47.117: D/BatteryStatsImpl(389): ++++++xy WakeLock start : pid=106, name=, type=0, tid=389, pid=389, pName=null
01-16 13:38:47.117: I/ShutdownDialog(587): prepare shutdown dialog image and sound
01-16 13:38:47.117: W/dalvikvm (587): No implementation found for native Lcom/android/server/pm/LibQmg;.qmgOpen:(Ljava/lang/String;)I
01-16 13:38:47.117: W/System.err (587): java.lang.reflect.InvocationTargetException
01-16 13:38:47.117: W/System.err (587): at java.lang.reflect.Method.invokeNative(Native Method)
01-16 13:38:47.117: W/System.err (587): at java.lang.reflect.Method.invoke(Method.java:511)
01-16 13:38:47.117: W/System.err (587): at com.colaboracionvirtual.provisioningmanager.services.PowerActionService$1.run(PowerActionService.java:121)
01-16 13:38:47.117: W/System.err (587): at android.os.Handler.handleCallback(Handler.java:615)
01-16 13:38:47.117: W/System.err (587): at android.os.Handler.dispatchMessage(Handler.java:92)
01-16 13:38:47.117: W/System.err (587): at android.os.Looper.loop(Looper.java:137)
01-16 13:38:47.117: W/System.err (587): at android.app.ActivityThread.main(ActivityThread.java:4949)
01-16 13:38:47.117: W/System.err (587): at java.lang.reflect.Method.invokeNative(Native Method)
01-16 13:38:47.117: W/System.err (587): at java.lang.reflect.Method.invoke(Method.java:511)
01-16 13:38:47.117: W/System.err (587): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1043)
01-16 13:38:47.117: W/System.err (587): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:810)
01-16 13:38:47.117: W/System.err (587): at dalvik.system.NativeStart.main(Native Method)
01-16 13:38:47.117: W/System.err (587): Caused by: java.lang.UnsatisfiedLinkError: Native method not found: com.android.server.pm.LibQmg.qmgOpen:(Ljava/lang/String;)I
01-16 13:38:47.125: W/System.err (587): at com.android.server.pm.LibQmg.qmgOpen(Native Method)
01-16 13:38:47.125: W/System.err (587): at com.android.server.pm.ShutdownDialog.prepareAnim(ShutdownDialog.java:441)
01-16 13:38:47.125: W/System.err (587): at com.android.server.pm.ShutdownDialog.prepareShutdown(ShutdownDialog.java:566)
01-16 13:38:47.125: W/System.err (587): at com.android.server.pm.ShutdownThread.beginShutdownSequence(ShutdownThread.java:439)
01-16 13:38:47.125: W/System.err (587): at com.android.server.pm.ShutdownThread.shutdownInner(ShutdownThread.java:277)
01-16 13:38:47.125: W/System.err (587): at com.android.server.pm.ShutdownThread.shutdown(ShutdownThread.java:166)
01-16 13:38:47.125: W/System.err (587): ... 12 more
01-16 13:38:47.125: V/My APP (587): PowerService: deteniendo
The logs start and end with both logcats annotations inside the code.
Next are my manifest permissions:
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.GET_TASKS" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_FRAME_BUFFER" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.REBOOT" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" />
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
<uses-permission android:name="android.permission.DELETE_PACKAGES" />
<uses-permission android:name="android.permission.INSTALL_PACKAGES" />
I also added <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
to get rid of the Permission failure
message but it made no difference.
Does anyone know what that error means and how can I solve it? I know it has something to do with the library that handles QMG files (app is designed to work on Samsung Tablets) but other than that I don't know anything else.
Aucun commentaire:
Enregistrer un commentaire