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

Commit 191069d5 authored by Winson's avatar Winson
Browse files

Test InstantAppResolverService method fallback

Verifies the appropriate methods are called or not called
when onGetInstantAppResolveInfo and onGetInstantAppIntentFilter
are invoked and different API versions are implemented.

There are 5 versions tested, with version 0 meaning no API was
implemented.

Bug: 137962971

Test: atest FrameworksInstantAppResolverTests
Test: manual swapped platform implementation to log method calls
		and verify call stack when under test

Change-Id: I66f84630d9824b74de57eaae71422d8773279a0f
parent 8dfb438b
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@ import android.os.UserHandle;
import android.util.Log;
import android.util.Slog;

import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.os.SomeArgs;

import java.util.Arrays;
@@ -297,7 +298,10 @@ public abstract class InstantAppResolverService extends Service {
    public static final class InstantAppResolutionCallback {
        private final IRemoteCallback mCallback;
        private final int mSequence;
        InstantAppResolutionCallback(int sequence, IRemoteCallback callback) {

        /** @hide **/
        @VisibleForTesting(visibility = VisibleForTesting.Visibility.PACKAGE)
        public InstantAppResolutionCallback(int sequence, IRemoteCallback callback) {
            mCallback = callback;
            mSequence = sequence;
        }
+4 −0
Original line number Diff line number Diff line
@@ -48,6 +48,10 @@
                }
            ],
            "file_patterns": ["INotificationManager\\.aidl"]
        },
        {
            "name": "FrameworksInstantAppResolverTests",
            "file_patterns": ["(/|^)InstantAppResolve[^/]*"]
        }
    ],
    "postsubmit": [
+6 −0
Original line number Diff line number Diff line
@@ -9,5 +9,11 @@
    {
      "path": "system/apex/tests"
    }
  ],
  "presubmit": [
    {
      "name": "FrameworksInstantAppResolverTests",
      "file_patterns": ["(/|^)InstantApp[^/]*"]
    }
  ]
}
+32 −0
Original line number Diff line number Diff line
//
// Copyright (C) 2019 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.
//

android_test {
    name: "FrameworksInstantAppResolverTests",
    srcs: [ "src/**/*.kt" ],
    libs: [
        "android.test.runner",
        "android.test.base",
    ],
    platform_apis: true,
    static_libs: [
        "androidx.test.ext.junit",
        "androidx.test.rules",
        "mockito-target-minus-junit4",
        "truth-prebuilt",
    ],
    test_suites: ["device-tests"],
}
+33 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (C) 2019 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
    xmlns:android="http://schemas.android.com/apk/res/android"
    package="android.app.instantapp.resolver.test"
    >

    <application>
        <uses-library android:name="android.test.runner"/>
    </application>

    <instrumentation
        android:name="androidx.test.runner.AndroidJUnitRunner"
        android:label="InstantAppResolverTests"
        android:targetPackage="android.app.instantapp.resolver.test"
        />

</manifest>
Loading