Were you able to remove the activity icon from launcher panel?
On Thu, Jun 18, 2009 at 10:29 AM, erictcrook <[email protected]> wrote:
> Ok, so, I am unable to use setComponentEnable.
>
> I apologize for the long post, I am trying to include all the helpful info
> here.
>
> ComponentName componentName =
> *new* ComponentName("com.ericcrook.disabletest",
> "com.ericcrook.disabletest.DisableActivity.class");
>
> pm.setComponentEnabledSetting(componentName, PackageManager.
> *COMPONENT_ENABLED_STATE_DISABLED*, PackageManager.*DONT_KILL_APP*);
>
> If the ComponentName points to this class, it runs without error, however
> the icon is still displayed in the Applications Drawer.
>
> If ComponentName points to another class in another package, it throws this
>
> 06-17 16:13:18.075: ERROR/AndroidRuntime(2026): Caused by:
> java.lang.SecurityException: Permission Denial: attempt to change component
> state from pid=2026, uid=10004, package uid=10032
> 06-17 16:13:18.075: ERROR/AndroidRuntime(2026): at
> android.os.Parcel.readException(Parcel.java:1234)
> 06-17 16:13:18.075: ERROR/AndroidRuntime(2026): at
> android.os.Parcel.readException(Parcel.java:1222)
> 06-17 16:13:18.075: ERROR/AndroidRuntime(2026): at
> android.content.pm.IPackageManager$Stub$Proxy.setComponentEnabledSetting(IPackageManager.java:1823)
> 06-17 16:13:18.075: ERROR/AndroidRuntime(2026): at
> android.app.ApplicationContext$ApplicationPackageManager.setComponentEnabledSetting(ApplicationContext.java:2421)
>
>
> Looking at the source found at:
>
> http://android.git.kernel.org/?p=platform/frameworks/base.git;a=blob;f=services/java/com/android/server/PackageManagerService.java;h=1f3ec2bd1f7e93655b10270b8691726de8ead421;hb=cupcake
> on line 4461
>
> this line appears:
>
> final int permission =
> mContext.checkCallingPermission(android.Manifest.permission.CHANGE_COMPONENT_ENABLED_STATE);
>
> This is later checked at line 4475:
> if (!allowedByPermission && (uid != pkgSetting.userId)) {
> throw new SecurityException(
>
> "Permission Denial: attempt to change component state
> from pid="
> + Binder.getCallingPid()
>
> + ", uid=" + uid + ", package uid=" +
> pkgSetting.userId);
> }
>
> The weird thing about all this is, when I set
>
> <uses-permission android:name=*
> "android.permission.CHANGE_COMPONENT_ENABLED_STATE"* />
>
> as a child of Manifest, when I install the app, it says, "No permissions
> required"
> If I request other permissions, they show up appropriately during install.
> I don't fully understand the uid check here, but I am looking into it.
> Thanks,
> Eric Crook
>
> n Wed, Jun 17, 2009 at 10:08 AM, Romain Guy <[email protected]> wrote:
>
>>
>> Launcher is the name of the application also called Home. So Home ==
>> Launcher and Launcher == Home.
>>
>> UNINSTALL_SHORTCUT can *only* be used to uninstall a shortcut from the
>> workspace (or desktop). Icons in the applications drawer can only be
>> uninstalled by either disabling the activities or uninstalling
>> packages via the PackageManager.
>>
>> > /*I explicitly send my intent to the launcher app. I only knew to do
>> this
>> > by looking
>> > at the source code I found here:
>> >
>> http://android.git.kernel.org/?p=platform/packages/apps/Launcher.git;a=blob;f=src/com/android/launcher/UninstallShortcutReceiver.java;h=e490f9c0f59e609ba70d82a8093c950285865267;hb=cupcake
>> > */
>> > intent.setComponent(
>> >
>> > new ComponentName("com.android.launcher",
>> > "com.android.launcher.UninstallShortcutReceiver"));
>>
>> There's absolutely no need to do this. All you need to do is set the
>> action to com.android.launcher.permission.UNINSTALL_SHORTCUT.
>>
>> --
>> Romain Guy
>> Android framework engineer
>> [email protected]
>>
>> Note: please don't send private questions to me, as I don't have time
>> to provide private support. All such questions should be posted on
>> public forums, where I and others can see and answer them
>> --~--~---------~--~----~------------~-------~--~----~
>> You received this message because you are subscribed to the Google
>> Groups "Android Developers" group.
>> To post to this group, send email to [email protected]
>> To unsubscribe from this group, send email to
>> [email protected]
>> For more options, visit this group at
>> http://groups.google.com/group/android-developers?hl=en
>> -~----------~----~----~----~------~----~------~--~---
>>
>>
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en