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

Commit 4af5b927 authored by Antony Sargent's avatar Antony Sargent
Browse files

New design for instant apps in app details header

Bug: 35098444
Test: make RunSettingsRoboTests

In the previous design for instant apps, some metadata about the app
such as developer title, maturity rating, etc. was going to be shown
in the app header. In the latest design, we instead are just showing
a little label that says "Instant app".

The two CL's for this topic work together to change this:

frameworks/base : adds code to work around the problem that
robolectric doesn't know about the new isInstantApp method of the
ApplicationInfo class, so we need to avoid calling it during tests.

pacakges/apps/Settings: removes the code that previously displayed
the instant app metadata, and instead just insert the "Instant app"
label.

Change-Id: Ie436085d4a257a1dd90b64d34d6ef15b8df369fd
parent c33b943f
Loading
Loading
Loading
Loading
+13 −1
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ import android.os.UserHandle;
import android.util.Log;

import com.android.settingslib.R;
import com.android.settingslib.applications.instantapps.InstantAppDataProvider;

import java.util.ArrayList;
import java.util.List;
@@ -35,6 +36,13 @@ import java.util.List;
public class AppUtils {
    private static final String TAG = "AppUtils";

    /**
     * This should normally only be set in robolectric tests, to avoid getting a method not found
     * exception when calling the isInstantApp method of the ApplicationInfo class, because
     * robolectric does not yet have an implementation of it.
     */
    private static InstantAppDataProvider sInstantAppDataProvider = null;

    public static CharSequence getLaunchByDefaultSummary(ApplicationsState.AppEntry appEntry,
            IUsbManager usbManager, PackageManager pm, Context context) {
        String packageName = appEntry.info.packageName;
@@ -74,7 +82,11 @@ public class AppUtils {
     * Returns a boolean indicating whether the given package should be considered an instant app
     */
    public static boolean isInstant(ApplicationInfo info) {
        if (info.isInstantApp()) {
        if (sInstantAppDataProvider != null) {
            if (sInstantAppDataProvider.isInstantApp(info)) {
                return true;
            }
        } else if (info.isInstantApp()) {
            return true;
        }

+28 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2017 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.
 */

package com.android.settingslib.applications.instantapps;

import android.content.pm.ApplicationInfo;

/**
 * This helps deal with the fact that robolectric does not yet have an implementation of the
 * isInstantApp method of ApplicationInfo, so we get a method not found exception when running tests
 * if we try to call it directly.
 */
public interface InstantAppDataProvider {
    public boolean isInstantApp(ApplicationInfo info);
}