4

我有一个启动器主题应用程序,允许用户从我的应用程序应用主题。

我正在尝试打开启动器的活动,但一直被拒绝许可。

这是我的意图(我已经尝试了很多不同的方式)

final Intent intent = new Intent(Intent.ACTION_MAIN, null);
        intent.addCategory(Intent.CATEGORY_LAUNCHER);
        final ComponentName cn = new ComponentName("com.tsf.shell", "com.tsf.shell.theme.ThemeManagerActivity");
        intent.setComponent(cn);
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        startActivity( intent);

这是错误的logcat

04-13 00:08:28.738: I/ActivityManager(710): START {act=com.tsf.shell cat=[android.intent.category.LAUNCHER] cmp=com.tsf.shell/.theme.ThemeManagerActivity u=0} from pid 20328
04-13 00:08:28.738: W/ActivityManager(710): Permission denied: checkComponentPermission() owningUid=10006
04-13 00:08:28.738: D/AndroidRuntime(20328): Shutting down VM
04-13 00:08:28.738: W/dalvikvm(20328): threadid=1: thread exiting with uncaught exception (group=0x40eee438)
04-13 00:08:28.738: W/ActivityManager(710): Permission Denial: starting Intent { act=com.tsf.shell cat=[android.intent.category.LAUNCHER] cmp=com.tsf.shell/.theme.ThemeManagerActivity } from ProcessRecord{42df8758 20328:bigdx.tabs/u0a47} (pid=20328, uid=10047) not exported from uid 10006
04-13 00:08:28.748: E/AndroidRuntime(20328): FATAL EXCEPTION: main
04-13 00:08:28.748: E/AndroidRuntime(20328): java.lang.SecurityException: Permission Denial: starting Intent { act=com.tsf.shell cat=[android.intent.category.LAUNCHER] cmp=com.tsf.shell/.theme.ThemeManagerActivity } from ProcessRecord{42df8758 20328:bigdx.tabs/u0a47} (pid=20328, uid=10047) not exported from uid 10006

是否存在无法从其他应用程序启动的某些活动?

这是我试图启动的实际启动器的清单

<?xml version="1.0" encoding="utf-8"?>
<manifest android:versionCode="33" android:versionName="1.9.9 Beta" android:installLocation="internalOnly" package="com.tsf.shell"
  xmlns:android="http://schemas.android.com/apk/res/android">
    <original-package android:name="com.tsf.shell" />
    <application android:label="@string/app_name" android:icon="@drawable/tsf_ico" android:name=".ShellApplication" android:persistent="true" android:debuggable="true">
        <activity android:theme="@style/AppTheme" android:name=".Home" android:process="com.tsf.shell" android:taskAffinity="com.tsf.shell" android:stateNotNeeded="true" android:launchMode="singleTask" android:screenOrientation="nosensor" android:configChanges="locale|mcc|mnc|keyboard|keyboardHidden|orientation|uiMode|screenSize" android:allowTaskReparenting="true" android:windowSoftInputMode="adjustPan">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.HOME" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.MONKEY" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:theme="@style/Theme.Translucent" android:name=".plugin.widgetpicker.ShortcutsPicker" android:process=":shortcutPicker" />
        <activity android:theme="@style/Theme.Translucent" android:name=".plugin.widgetpicker.AppWidgetPicker" android:process=":widgetPicker" />
        <activity android:theme="@style/DialogTheme" android:name=".plugin.iconpicker.IconPicker" android:process=":iconPicker" />
        <activity android:theme="@style/Theme.Translucent" android:name=".VersionDetailActivity" android:process=":versionDetail" />
        <activity android:theme="@style/NoTitleBar" android:name=".theme.ThemeManagerActivity" android:process=":themes" />
        <activity android:theme="@style/NoTitleBar" android:name=".theme.ThemeDetailedActivity" android:process=":themes" />
        <activity android:theme="@style/Theme.Translucent" android:name=".activity.PhotoSelectorActivity" />
        <activity android:name=".preference.SettingPreferenceActivity" />
        <activity android:name=".preference.SettingDrawerPreferenceActivity" />
        <activity android:name=".preference.SettingDockPreferenceActivity" />
        <activity android:theme="@style/NoTitleBar" android:name=".action.ActionSelector" android:process=":gesture" />
        <activity android:name=".preference.SettingGesturePreferenceActivity" android:process=":gesture" />
        <activity android:theme="@style/NoTitleBar" android:name=".usermanual.TSFUserManualActivity" android:process=":UserManual" />
        <activity android:theme="@style/Theme.NoTitleBar.NoBackground" android:name=".RestartActivity" android:process=":restart" android:launchMode="singleTask" android:configChanges="keyboard|keyboardHidden|orientation" />
        <activity android:label="@string/pick_wallpaper" android:icon="@drawable/tsf_ico" android:name=".ShellWallpaperSelector" android:process=":wallpaperSelector" android:launchMode="singleTask" android:screenOrientation="nosensor" android:finishOnCloseSystemDialogs="true">
            <intent-filter>
                <action android:name="android.intent.action.SET_WALLPAPER" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>
        <service android:name=".services.ForegroundService" android:enabled="true">
            <intent-filter>
                <action android:name="com.tsf.shell.services.FOREGROUND" />
            </intent-filter>
        </service>
        <provider android:name="com.tsf.shell.ShellProvider" android:readPermission="com.tsf.shell.permission.READ_SETTINGS" android:writePermission="com.tsf.shell.permission.WRITE_SETTINGS" android:authorities="com.tsf.shell.settings" />
    </application>
    <supports-screens android:anyDensity="true" android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" />
    <uses-permission android:name="android.permission.EXPAND_STATUS_BAR" />
    <uses-permission android:name="android.permission.CALL_PHONE" />
    <uses-permission android:name="android.permission.READ_LOGS" />
    <uses-permission android:name="com.android.vending.CHECK_LICENSE" />
    <uses-permission android:name="android.permission.READ_CONTACTS" />
    <uses-permission android:name="android.permission.PERSISTENT_ACTIVITY" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
    <uses-permission android:name="android.permission.BLUETOOTH" />
    <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-permission android:name="android.permission.WRITE_SETTINGS" />
    <uses-permission android:name="com.android.browser.permission.READ_HISTORY_BOOKMARKS" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.RESTART_PACKAGES" />
    <uses-permission android:name="android.permission.KILL_BACKGROUND_PROCESSES" />
    <uses-permission android:name="android.permission.SET_WALLPAPER" />
    <uses-permission android:name="android.permission.SET_WALLPAPER_HINTS" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-feature android:name="android.hardware.telephony" android:required="false" />
    <uses-feature android:name="android.hardware.bluetooth" android:required="false" />
    <uses-feature android:name="android.hardware.location" android:required="false" />
    <uses-feature android:name="android.hardware.location.network" android:required="false" />
    <uses-feature android:name="android.hardware.location.gps" android:required="false" />
    <uses-feature android:glEsVersion="0x20000" android:required="true" />
</manifest>
4

1 回答 1

3

问题不在您的调用应用程序中。似乎问题出在被调用的应用程序中。检查被调用应用程序接收intent的receiver是否被导出。采用

android:exported="true"

文档_android:exported

广播接收器是否可以从其应用程序之外的源接收消息 - 如果可以,则为“true”,否则为“false”。如果为“false”,则广播接收器可以接收的唯一消息是由相同应用程序的组件或具有相同用户 ID 的应用程序发送的消息。

于 2013-04-13T05:30:07.163 回答