[General Questions and Answers] Xuuuud:
Hello evenryone:

I'm designing an application for removing recents tasks. Because of the need to access system permissions like REMOVE_TASKS and

READ_FRAME_BUFFER, I have sigend my apk file using platform signature and pushed it into /system/app.

After reboot, i found that the app was successfully installed as system app, and permission READ_FRAME_BUFFER was passed, as

application thumb nails were shown. But what confused me most was that permission REMOVE_TASKS seemed to be denied in some way,

tasks being not removed from task list and would be listed next time running this app.

AndroidManifest.xml:

<uses-permission android:name="android.permission.GET_TASKS"/>
<uses-permission android:name="android.permission.REMOVE_TASKS"/>
<uses-permission android:name="android.permission.READ_FRAME_BUFFER"/>

Logs read like this:

06-21 17:49:12.171: W/System.err(1540): java.lang.reflect.InvocationTargetException
06-21 17:49:12.171: W/ActivityManager(391): Permission Denial: removeTask() from pid=1540, uid=10068 requires android.permission.REMOVE_TASKS
06-21 17:49:12.179: W/System.err(1540):	at java.lang.reflect.Method.invokeNative(Native Method)
06-21 17:49:12.179: W/System.err(1540):	at java.lang.reflect.Method.invoke(Method.java:511)
06-21 17:49:12.179: W/System.err(1540):	at com.newbee.recentstaskmanager.RecentsPanelView.removeTask(RecentsPanelView.java:611)
06-21 17:49:12.179: W/System.err(1540):	at com.newbee.recentstaskmanager.RecentsPanelView.handleSwipe(RecentsPanelView.java:549)
06-21 17:49:12.179: W/System.err(1540):	at com.newbee.recentstaskmanager.RecentsVerticalScrollView.onChildDismissed(RecentsVerticalScrollView.java:144)
06-21 17:49:12.179: W/System.err(1540):	at com.newbee.recentstaskmanager.SwipeHelper$1.onAnimationEnd(SwipeHelper.java:220)
06-21 17:49:12.179: W/System.err(1540):	at android.animation.ValueAnimator.endAnimation(ValueAnimator.java:1012)
06-21 17:49:12.179: W/System.err(1540):	at android.animation.ValueAnimator.access$400(ValueAnimator.java:51)
06-21 17:49:12.179: W/System.err(1540):	at android.animation.ValueAnimator$AnimationHandler.doAnimationFrame(ValueAnimator.java:623)
06-21 17:49:12.179: W/System.err(1540):	at android.animation.ValueAnimator$AnimationHandler.run(ValueAnimator.java:639)
06-21 17:49:12.179: W/System.err(1540):	at android.view.Choreographer$CallbackRecord.run(Choreographer.java:749)
06-21 17:49:12.179: W/System.err(1540):	at android.view.Choreographer.doCallbacks(Choreographer.java:562)
06-21 17:49:12.179: W/System.err(1540):	at android.view.Choreographer.doFrame(Choreographer.java:531)
06-21 17:49:12.179: W/System.err(1540):	at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:735)
06-21 17:49:12.179: W/System.err(1540):	at android.os.Handler.handleCallback(Handler.java:725)
06-21 17:49:12.179: W/System.err(1540):	at android.os.Handler.dispatchMessage(Handler.java:92)
06-21 17:49:12.179: W/System.err(1540):	at android.os.Looper.loop(Looper.java:137)
06-21 17:49:12.179: W/System.err(1540):	at android.app.ActivityThread.main(ActivityThread.java:5041)
06-21 17:49:12.179: W/System.err(1540):	at java.lang.reflect.Method.invokeNative(Native Method)
06-21 17:49:12.179: W/System.err(1540):	at java.lang.reflect.Method.invoke(Method.java:511)
06-21 17:49:12.179: W/System.err(1540):	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
06-21 17:49:12.179: W/System.err(1540):	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
06-21 17:49:12.179: W/System.err(1540):	at dalvik.system.NativeStart.main(Native Method)
06-21 17:49:12.187: W/System.err(1540): Caused by: java.lang.SecurityException: Permission Denial: removeTask() from pid=1540, uid=10068 requires android.permission.REMOVE_TASKS
06-21 17:49:12.187: W/System.err(1540):	at android.os.Parcel.readException(Parcel.java:1425)
06-21 17:49:12.187: W/System.err(1540):	at android.os.Parcel.readException(Parcel.java:1379)
06-21 17:49:12.187: W/System.err(1540):	at android.app.ActivityManagerProxy.removeTask(ActivityManagerNative.java:3940)
06-21 17:49:12.187: W/System.err(1540):	at android.app.ActivityManager.removeTask(ActivityManager.java:792)
06-21 17:49:12.187: W/System.err(1540):	... 23 more

I know exactly that there may be something wrong with uid or pid, so I tried to changed the uid by android:shareUserId="android.uid.system"

But new problem arised that it could not even be installed and couldn't appear in the launcher this time. Please help me!