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

Commit 4f58263d authored by Amith Yamasani's avatar Amith Yamasani
Browse files

Launcher APIs and broadcasts for managed profiles

UserManager
- Corp badging
- Querying list of managed profiles

Launcher API
- LauncherApps and Service to proxy changes in managed profile
  to the launcher in the primary profile
- Querying and launching launchable apps across profiles

Change-Id: Id8f7b4201afdfb5f414d04156d7b81300119289e
parent 2d925545
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -119,6 +119,8 @@ LOCAL_SRC_FILES += \
	core/java/android/content/ISyncContext.aidl \
	core/java/android/content/ISyncServiceAdapter.aidl \
	core/java/android/content/ISyncStatusObserver.aidl \
	core/java/android/content/pm/ILauncherApps.aidl \
	core/java/android/content/pm/IOnAppsChangedListener.aidl \
	core/java/android/content/pm/IPackageDataObserver.aidl \
	core/java/android/content/pm/IPackageDeleteObserver.aidl \
	core/java/android/content/pm/IPackageInstallObserver.aidl \
+28 −0
Original line number Diff line number Diff line
@@ -6476,6 +6476,7 @@ package android.content {
    field public static final java.lang.String INPUT_METHOD_SERVICE = "input_method";
    field public static final java.lang.String INPUT_SERVICE = "input";
    field public static final java.lang.String KEYGUARD_SERVICE = "keyguard";
    field public static final java.lang.String LAUNCHER_APPS_SERVICE = "launcherapps";
    field public static final java.lang.String LAYOUT_INFLATER_SERVICE = "layout_inflater";
    field public static final java.lang.String LOCATION_SERVICE = "location";
    field public static final java.lang.String MEDIA_ROUTER_SERVICE = "media_router";
@@ -7650,6 +7651,32 @@ package android.content.pm {
    field public static final android.os.Parcelable.Creator CREATOR;
  }
  public class LauncherActivityInfo {
    method public int getApplicationFlags();
    method public android.graphics.drawable.Drawable getBadgedIcon(int);
    method public android.content.ComponentName getComponentName();
    method public long getFirstInstallTime();
    method public android.graphics.drawable.Drawable getIcon(int);
    method public java.lang.CharSequence getLabel();
    method public android.os.UserHandle getUser();
  }
  public class LauncherApps {
    method public synchronized void addOnAppsChangedListener(android.content.pm.LauncherApps.OnAppsChangedListener);
    method public java.util.List<android.content.pm.LauncherActivityInfo> getActivityList(java.lang.String, android.os.UserHandle);
    method public synchronized void removeOnAppsChangedListener(android.content.pm.LauncherApps.OnAppsChangedListener);
    method public android.content.pm.LauncherActivityInfo resolveActivity(android.content.Intent, android.os.UserHandle);
    method public void startActivityForProfile(android.content.ComponentName, android.graphics.Rect, android.os.Bundle, android.os.UserHandle);
  }
  public static abstract interface LauncherApps.OnAppsChangedListener {
    method public abstract void onPackageAdded(android.os.UserHandle, java.lang.String);
    method public abstract void onPackageChanged(android.os.UserHandle, java.lang.String);
    method public abstract void onPackageRemoved(android.os.UserHandle, java.lang.String);
    method public abstract void onPackagesAvailable(android.os.UserHandle, java.lang.String[], boolean);
    method public abstract void onPackagesUnavailable(android.os.UserHandle, java.lang.String[], boolean);
  }
  public class PackageInfo implements android.os.Parcelable {
    ctor public PackageInfo();
    method public int describeContents();
@@ -19898,6 +19925,7 @@ package android.os {
    method public int getUserCount();
    method public android.os.UserHandle getUserForSerialNumber(long);
    method public java.lang.String getUserName();
    method public java.util.List<android.os.UserHandle> getUserProfiles();
    method public android.os.Bundle getUserRestrictions();
    method public android.os.Bundle getUserRestrictions(android.os.UserHandle);
    method public boolean isUserAGoat();
+10 −0
Original line number Diff line number Diff line
@@ -36,7 +36,9 @@ import android.content.ReceiverCallNotAllowedException;
import android.content.ServiceConnection;
import android.content.SharedPreferences;
import android.content.pm.ApplicationInfo;
import android.content.pm.ILauncherApps;
import android.content.pm.IPackageManager;
import android.content.pm.LauncherApps;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.res.AssetManager;
@@ -605,6 +607,14 @@ class ContextImpl extends Context {
            }
        });

        registerService(LAUNCHER_APPS_SERVICE, new ServiceFetcher() {
            public Object createService(ContextImpl ctx) {
                IBinder b = ServiceManager.getService(LAUNCHER_APPS_SERVICE);
                ILauncherApps service = ILauncherApps.Stub.asInterface(b);
                return new LauncherApps(ctx, service);
            }
        });

        registerService(PRINT_SERVICE, new ServiceFetcher() {
            public Object createService(ContextImpl ctx) {
                IBinder iBinder = ServiceManager.getService(Context.PRINT_SERVICE);
+11 −0
Original line number Diff line number Diff line
@@ -1999,6 +1999,7 @@ public abstract class Context {
            BLUETOOTH_SERVICE,
            //@hide: SIP_SERVICE,
            USB_SERVICE,
            LAUNCHER_APPS_SERVICE,
            //@hide: SERIAL_SERVICE,
            INPUT_SERVICE,
            DISPLAY_SERVICE,
@@ -2561,6 +2562,16 @@ public abstract class Context {
     */
    public static final String USER_SERVICE = "user";

    /**
     * Use with {@link #getSystemService} to retrieve a
     * {@link android.content.pm.LauncherApps} for querying and monitoring launchable apps across
     * profiles of a user.
     *
     * @see #getSystemService
     * @see android.content.pm.LauncherApps
     */
    public static final String LAUNCHER_APPS_SERVICE = "launcherapps";

    /**
     * Use with {@link #getSystemService} to retrieve a
     * {@link android.app.AppOpsManager} for tracking application operations
+38 −0
Original line number Diff line number Diff line
/**
 * Copyright (c) 2014, 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 android.content.pm;

import android.content.ComponentName;
import android.content.Intent;
import android.content.pm.IOnAppsChangedListener;
import android.content.pm.ResolveInfo;
import android.graphics.Rect;
import android.os.Bundle;
import android.os.UserHandle;
import java.util.List;

/**
 * {@hide}
 */
interface ILauncherApps {
    void addOnAppsChangedListener(in IOnAppsChangedListener listener);
    void removeOnAppsChangedListener(in IOnAppsChangedListener listener);
    List<ResolveInfo> getLauncherActivities(String packageName, in UserHandle user);
    ResolveInfo resolveActivity(in Intent intent, in UserHandle user);
    void startActivityAsUser(in ComponentName component, in Rect sourceBounds,
            in Bundle opts, in UserHandle user);
}
Loading