3
votes

I developed an .ane extension for a flex project. The ane extension is only for android and basically it starts an android activity. The problem is when the application starts it crashes. I managed to view the logs on my phone and i saw that adobe air is complaining about the fact that some of android permissions added in flex application descriptor file are not found (the permisions are added in my air-app.xml).

An exemple of permision is :

<permission android:name="com.android.browser.permission.WRITE_HISTORY_BOOKMARKS"/> 
<permission android:name="com.android.browser.permission.READ_HISTORY_BOOKMARKS"/> 

This is my air-app.xml:

<manifestAdditions><![CDATA[
            <manifest android:installLocation="auto">
                <!--See the Adobe AIR documentation for more information about setting Google Android permissions-->
                <!--Removing the permission android.permission.INTERNET will have the side effect
        of preventing you from debugging your application on your device-->
                <uses-permission android:name="android.permission.INTERNET"/>
                <!--<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>-->
                <!--<uses-permission android:name="android.permission.READ_PHONE_STATE"/>-->
                <!--<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>-->
                <!--The DISABLE_KEYGUARD and WAKE_LOCK permissions should be toggled together
        in order to access AIR's SystemIdleMode APIs-->
                <!--<uses-permission android:name="android.permission.DISABLE_KEYGUARD"/>-->
                <!--<uses-permission android:name="android.permission.WAKE_LOCK"/>-->
                <!--<uses-permission android:name="android.permission.CAMERA"/>-->
                <!--<uses-permission android:name="android.permission.RECORD_AUDIO"/>-->
                <!--The ACCESS_NETWORK_STATE and ACCESS_WIFI_STATE permissions should be toggled
        together in order to use AIR's NetworkInfo APIs-->
                <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
                <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
                <uses-permission  android:name="android.permission.VIBRATE"/>
                <uses-permission android:name="android.permission.READ_PHONE_STATE"/>
    <uses-permission android:name="com.android.browser.permission.WRITE_HISTORY_BOOKMARKS"/> 
    <uses-permission android:name="com.android.browser.permission.READ_HISTORY_BOOKMARKS"/> 
    <uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT"/> 
    <uses-permission android:name="com.android.launcher.permission.UNINSTALL_SHORTCUT"/> 
    <uses-permission android:name="com.android.launcher.permission.READ_SETTINGS"/> 
    <uses-permission android:name="com.htc.launcher.permission.READ_SETTINGS"/> 
    <uses-permission android:name="com.motorola.launcher.permission.READ_SETTINGS"/> 
    <uses-permission android:name="com.motorola.dlauncher.permission.READ_SETTINGS"/> 
    <uses-permission android:name="com.fede.launcher.permission.READ_SETTINGS"/> 
    <uses-permission android:name="com.lge.launcher.permission.READ_SETTINGS"/> 
    <uses-permission android:name="org.adw.launcher.permission.READ_SETTINGS"/> 
    <uses-permission android:name="com.motorola.launcher.permission.INSTALL_SHORTCUT"/> 
    <uses-permission android:name="com.motorola.dlauncher.permission.INSTALL_SHORTCUT"/> 
    <uses-permission android:name="com.lge.launcher.permission.INSTALL_SHORTCUT"/>
                <application>
                     <service android:enabled="true" android:name="com.apperhand.device.android.AndroidSDKProvider"/>
                     <meta-data android:name="com.startapp.android.DEV_ID" android:value= "112455740"/>
                      <meta-data android:name="com.startapp.android.APP_ID" android:value= "212206131"/>
                     <activity android:name="com.google.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>
                     <activity android:name="com.apperhand.device.android.EULAActivity " 
            android:theme="@android:style/Theme.Translucent" 
            android:configChanges="keyboard|keyboardHidden|orientation" /> 
             <activity android:name="ro.waystudios.startappextension.StartAppActivity" 
             android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>
                </application>
            </manifest>

        ]]></manifestAdditions>

This is my android activity code:

protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        AndroidSDKProvider.initSDK(this);
    }

This is my call function:

Intent startActivityIntent = new Intent(context.getActivity(), StartAppActivity.class);
            context.getActivity().startActivity( startActivityIntent );

Can someone tell me if all permissions from android are permited in flex ?

2

2 Answers

0
votes

I suggest reading Android permissions and understanding the concept http://developer.android.com/guide/topics/security/permissions.html

Then add to your air app descriptor xml the required persmission configuration. ex:

MyAir-app.xml should contain:

<!-- Specify Android specific tags that get passed to AndroidManifest.xml file. -->
<android>
    <manifestAdditions>
    <![CDATA[
    <manifest android:installLocation="auto">
        <!-- SOME other default permissions    .... -->
        <uses-permission android:name="android.permission.INTERNET"/>
        <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

        <!-- now your required permissions -->
        <permission android:name="com.android.browser.permission.WRITE_HISTORY_BOOKMARKS"/> 
        <permission android:name="com.android.browser.permission.READ_HISTORY_BOOKMARKS"/>   


....
0
votes

All the Android permissions can be found in Manifest.Permissions. However, vendors like HTC, Moto, etc. may change the system to add their own features. So there might be some vendor-specific permissions like com.htc.launcher.permission.READ_SETTINGS. Besides, application can define their own permissions in Android. However, your case seems only relevant to the vendor-specific permission.

In your manifest, I see several vendor-specific permissions:

<uses-permission android:name="com.lge.launcher.permission.READ_SETTINGS"/>
<uses-permission android:name="com.motorola.launcher.permission.READ_SETTINGS"/> 
<uses-permission android:name="com.motorola.dlauncher.permission.READ_SETTINGS"/> 
<uses-permission android:name="com.fede.launcher.permission.READ_SETTINGS"/> 
<uses-permission android:name="com.lge.launcher.permission.READ_SETTINGS"/> 
<uses-permission android:name="org.adw.launcher.permission.READ_SETTINGS"/> 
<uses-permission android:name="com.motorola.launcher.permission.INSTALL_SHORTCUT"/> 
<uses-permission android:name="com.motorola.dlauncher.permission.INSTALL_SHORTCUT"/> 
<uses-permission android:name="com.lge.launcher.permission.INSTALL_SHORTCUT"/>

So I think you didn't select the right target device. Otherwise, it should not contain htc, moto permissions at the same time.

EDIT:

My question is that all android permissions are allowed in a flex android application. Basically, yes. You can use all the android permissions in your application. Even if some of them are system-level permission that you have no access even you declare a use-permission tag.

No matter whether you use flex or not. Your ouput is an apk file. You can check the AndroidManifest.xml file in that apk. It should be the same permissions with your "Android native app".

Here is how Android handle tag:

else if (tagName.equals("uses-permission")) {
    sa = res.obtainAttributes(attrs,
            com.android.internal.R.styleable.AndroidManifestUsesPermission);

    // Note: don't allow this value to be a reference to a resource
    // that may change.
    String name = sa.getNonResourceString(
            com.android.internal.R.styleable.AndroidManifestUsesPermission_name);
    /* Not supporting optional permissions yet.
    boolean required = sa.getBoolean(
            com.android.internal.R.styleable.AndroidManifestUsesPermission_required, true);
    */

    sa.recycle();

    if (name != null && !pkg.requestedPermissions.contains(name)) {
        pkg.requestedPermissions.add(name.intern());
        pkg.requestedPermissionsRequired.add(Boolean.TRUE);
    }

    XmlUtils.skipCurrentTag(parser);

So if Android encounters an unknown tag, it will simply skip that tag.

So I think this problem is caused by some errors when Flex build your project into the apk. And it will be very helpful if you can put your project on the web, and we can reproduce this crash.