Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6dffdf82 authored by Todd Kennedy's avatar Todd Kennedy Committed by Android (Google) Code Review
Browse files

Merge "Fix intent filter priorities" into nyc-dev

parents 18e7e10f 5585dd97
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -883,6 +883,15 @@ public class IntentFilter implements Parcelable {
            return true;
        }

        @Override
        public boolean equals(Object obj) {
            if (obj instanceof AuthorityEntry) {
                final AuthorityEntry other = (AuthorityEntry)obj;
                return match(other);
            }
            return false;
        }

        /**
         * Determine whether this AuthorityEntry matches the given data Uri.
         * <em>Note that this comparison is case-sensitive, unlike formal
@@ -917,7 +926,7 @@ public class IntentFilter implements Parcelable {
            }
            return MATCH_CATEGORY_HOST;
        }
    };
    }

    /**
     * Add a new Intent data "scheme specific part" to match against.  The filter must
+61 −0
Original line number Diff line number Diff line
#
# Copyright (C) 2016 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

LOCAL_PATH := $(call my-dir)

###########################################################
# Variant: Privileged app

include $(CLEAR_VARS)
# this needs to be a privileged application
LOCAL_PRIVILEGED_MODULE := true

LOCAL_MODULE_TAGS := optional
LOCAL_SDK_VERSION := current
LOCAL_PROGUARD_ENABLED := disabled
LOCAL_DEX_PREOPT := false

LOCAL_PACKAGE_NAME := CtsShimPriv

#TODO need to find the correct certificate
#Change in conjunction with cts/hostsidetests/appsecurity/test-apps/IntentFilterApp
LOCAL_CERTIFICATE := platform
LOCAL_MANIFEST_FILE := priv_shim/AndroidManifest.xml

include $(BUILD_PACKAGE)



###########################################################
# Variant: System app

include $(CLEAR_VARS)

LOCAL_MODULE_TAGS := optional
LOCAL_SDK_VERSION := current
LOCAL_PROGUARD_ENABLED := disabled
LOCAL_DEX_PREOPT := false

LOCAL_PACKAGE_NAME := CtsShim

#TODO need to find the correct certificate
#Change in conjunction with cts/hostsidetests/appsecurity/test-apps/IntentFilterApp
LOCAL_CERTIFICATE := platform
LOCAL_MANIFEST_FILE := shim/AndroidManifest.xml

include $(BUILD_PACKAGE)

+157 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2016 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->

<!-- Manifest for the privileged CTS shim -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="com.android.cts.priv.ctsshim">
    <application android:label="CtsShim">

        <!-- These activities don't actually exist; define them just to test the filters !-->

        <!-- install test; [some] high priority filters granted -->
        <activity android:name=".InstallPriority">
            <!-- normal actions; priority will be granted -->
            <intent-filter android:priority="100">
                <action android:name="android.intent.action.SEARCH" />
                <category android:name="android.intent.category.INFO" />
            </intent-filter>

            <!-- protected actions; priority will be denied -->
            <intent-filter android:priority="100">
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.BROWSABLE" />
            </intent-filter>
            <intent-filter android:priority="100">
                <action android:name="android.intent.action.SEND" />
            </intent-filter>
            <intent-filter android:priority="100">
                <action android:name="android.intent.action.SEND_MULTIPLE" />
            </intent-filter>
            <intent-filter android:priority="100">
                <action android:name="android.intent.action.SENDTO" />
            </intent-filter>
        </activity>

        <!-- upgrade test; single, equivalent filter -->
        <activity android:name=".UpgradeMatch">
            <intent-filter android:priority="100">
                <action android:name="com.android.cts.action.MATCH" />
                <category android:name="android.intent.category.INFO" />
            </intent-filter>
        </activity>

        <!-- upgrade test; multiple, equivalent filters -->
        <activity android:name=".UpgradeMatchMultiple">
            <intent-filter android:priority="100">
                <action android:name="com.android.cts.action.MATCH_MULTIPLE" />
                <category android:name="android.intent.category.INFO" />
            </intent-filter>

            <intent-filter android:priority="150">
                <action android:name="com.android.cts.action.MATCH_MULTIPLE" />
                <category android:name="android.intent.category.DEFAULT" />
                <data android:scheme="http" />
                <data android:scheme="https" />
                <data android:host="www.google.com" android:port="80" />
                <data android:host="www.google.com" android:port="8080" />
                <data android:host="goo.gl" android:port="443" />
            </intent-filter>
        </activity>

        <!-- upgrade test; lower priority -->
        <activity android:name=".UpgradeLowerPriority">
            <intent-filter android:priority="100">
                <action android:name="com.android.cts.action.LOWER_PRIORITY" />
                <category android:name="android.intent.category.INFO" />
            </intent-filter>
        </activity>

        <!-- upgrade test; action subset -->
        <activity android:name=".UpgradeActionSubset">
            <intent-filter android:priority="100">
                <action android:name="com.android.cts.action.ACTION_SUB" />
                <action android:name="com.android.cts.action.ACTION_SUB_2" />
                <action android:name="com.android.cts.action.ACTION_SUB_3" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>

        <!-- upgrade test; category subset -->
        <activity android:name=".UpgradeCategorySubset">
            <intent-filter android:priority="100">
                <action android:name="com.android.cts.action.CATEGORY_SUB" />
                <category android:name="android.intent.category.INFO" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>

        <!-- upgrade test; scheme subset -->
        <activity android:name=".UpgradeSchemeSubset">
            <intent-filter android:priority="100">
                <action android:name="com.android.cts.action.SCHEME_SUB" />
                <data android:scheme="content" />
                <data android:scheme="flubber" />
                <data android:scheme="zoodle" />
            </intent-filter>
        </activity>

        <!-- upgrade test; authority subset -->
        <activity android:name=".UpgradeAuthoritySubset">
            <intent-filter android:priority="100">
                <action android:name="com.android.cts.action.AUTHORITY_SUB" />
                <data android:host="www.google.com" android:port="80" />
                <data android:host="www.google.com" android:port="8080" />
                <data android:host="mail.google.com" android:port="80" />
                <data android:host="goo.gl" android:port="443" />
            </intent-filter>
        </activity>


        <!-- upgrade test; new action -->
        <activity android:name=".UpgradeNewAction">
            <intent-filter android:priority="100">
                <action android:name="com.android.cts.action.NEW_ACTION" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>

        <!-- upgrade test; new category -->
        <activity android:name=".UpgradeNewCategory">
            <intent-filter android:priority="100">
                <action android:name="com.android.cts.action.NEW_CATEGORY" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>

        <!-- upgrade test; new scheme -->
        <activity android:name=".UpgradeNewScheme">
            <intent-filter android:priority="100">
                <action android:name="com.android.cts.action.NEW_SCHEME" />
                <data android:scheme="content" />
            </intent-filter>
        </activity>

        <!-- upgrade test; new authority -->
        <activity android:name=".UpgradeNewAuthority">
            <intent-filter android:priority="100">
                <action android:name="com.android.cts.action.NEW_AUTHORITY" />
                <data android:host="www.google.com" android:port="80" />
            </intent-filter>
        </activity>

    </application>
</manifest>
+47 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2016 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->

<!-- Manifest for the system CTS shim -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="com.android.cts.system.ctsshim">
    <application android:label="CtsShim">

        <!-- These activities don't actually exist; define them just to test the filters !-->

        <!-- install test; high priority filter DENIED -->
        <activity android:name=".InstallPriority">
            <intent-filter android:priority="100">
                <action android:name="android.intent.action.SEARCH" />
                <category android:name="android.intent.category.INFO" />
            </intent-filter>
            <intent-filter android:priority="100">
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.BROWSABLE" />
            </intent-filter>
            <intent-filter android:priority="100">
                <action android:name="android.intent.action.SEND" />
            </intent-filter>
            <intent-filter android:priority="100">
                <action android:name="android.intent.action.SEND_MULTIPLE" />
            </intent-filter>
            <intent-filter android:priority="100">
                <action android:name="android.intent.action.SENDTO" />
            </intent-filter>
        </activity>

    </application>
</manifest>
+375 −22

File changed.

Preview size limit exceeded, changes collapsed.