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

Commit b0d22627 authored by Tony Mak's avatar Tony Mak
Browse files

Rename CrossProfileApps API as per API council feedback

Three changes:
1. android.content.pm.crossprofile - > android.content.pm
2. getProfileSwitchingIcon -> getProfileSwitchingIconDrawable
3. startMainActivity “user” parameter should be named “targetUser”

Test: atest FrameworksServicesTests:com.android.server.pm.CrossProfileAppsServiceImplTest
Test: atest frameworks/base/core/tests/coretests/src/android/content/pm/CrossProfileAppsTest.java
Test: atest cts/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/CrossProfileAppsHostSideTest.java

FIXES: 71818128

Change-Id: Icf9a6d1f8b6808935ffd79b43185c7b12235f349
parent e8ffec16
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -117,7 +117,7 @@ java_library {
        "core/java/android/content/ISyncServiceAdapter.aidl",
        "core/java/android/content/ISyncStatusObserver.aidl",
        "core/java/android/content/om/IOverlayManager.aidl",
        "core/java/android/content/pm/crossprofile/ICrossProfileApps.aidl",
        "core/java/android/content/pm/ICrossProfileApps.aidl",
        "core/java/android/content/pm/IDexModuleRegisterCallback.aidl",
        "core/java/android/content/pm/ILauncherApps.aidl",
        "core/java/android/content/pm/IOnAppsChangedListener.aidl",
+7 −11
Original line number Diff line number Diff line
@@ -10683,6 +10683,13 @@ package android.content.pm {
    field public int reqTouchScreen;
  }
  public class CrossProfileApps {
    method public android.graphics.drawable.Drawable getProfileSwitchingIconDrawable(android.os.UserHandle);
    method public java.lang.CharSequence getProfileSwitchingLabel(android.os.UserHandle);
    method public java.util.List<android.os.UserHandle> getTargetUserProfiles();
    method public void startMainActivity(android.content.ComponentName, android.os.UserHandle);
  }
  public final class FeatureGroupInfo implements android.os.Parcelable {
    ctor public FeatureGroupInfo();
    ctor public FeatureGroupInfo(android.content.pm.FeatureGroupInfo);
@@ -11477,17 +11484,6 @@ package android.content.pm {
}
package android.content.pm.crossprofile {
  public class CrossProfileApps {
    method public android.graphics.drawable.Drawable getProfileSwitchingIcon(android.os.UserHandle);
    method public java.lang.CharSequence getProfileSwitchingLabel(android.os.UserHandle);
    method public java.util.List<android.os.UserHandle> getTargetUserProfiles();
    method public void startMainActivity(android.content.ComponentName, android.os.UserHandle);
  }
}
package android.content.res {
  public class AssetFileDescriptor implements java.io.Closeable android.os.Parcelable {
+2 −2
Original line number Diff line number Diff line
@@ -38,12 +38,12 @@ import android.content.ClipboardManager;
import android.content.Context;
import android.content.IRestrictionsManager;
import android.content.RestrictionsManager;
import android.content.pm.CrossProfileApps;
import android.content.pm.ICrossProfileApps;
import android.content.pm.IShortcutService;
import android.content.pm.LauncherApps;
import android.content.pm.PackageManager;
import android.content.pm.ShortcutManager;
import android.content.pm.crossprofile.CrossProfileApps;
import android.content.pm.crossprofile.ICrossProfileApps;
import android.content.res.Resources;
import android.hardware.ConsumerIrManager;
import android.hardware.ISerialManager;
+1 −1
Original line number Diff line number Diff line
@@ -4146,7 +4146,7 @@ public abstract class Context {

    /**
     * Use with {@link #getSystemService(String)} to retrieve a
     * {@link android.content.pm.crossprofile.CrossProfileApps} for cross profile operations.
     * {@link android.content.pm.CrossProfileApps} for cross profile operations.
     *
     * @see #getSystemService(String)
     */
+8 −7
Original line number Diff line number Diff line
@@ -13,7 +13,7 @@
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package android.content.pm.crossprofile;
package android.content.pm;

import android.annotation.NonNull;
import android.content.ComponentName;
@@ -57,13 +57,14 @@ public class CrossProfileApps {
     *        action {@link android.content.Intent#ACTION_MAIN}, category
     *        {@link android.content.Intent#CATEGORY_LAUNCHER}. Otherwise, SecurityException will
     *        be thrown.
     * @param user The UserHandle of the profile, must be one of the users returned by
     * @param targetUser The UserHandle of the profile, must be one of the users returned by
     *        {@link #getTargetUserProfiles()}, otherwise a {@link SecurityException} will
     *        be thrown.
     */
    public void startMainActivity(@NonNull ComponentName component, @NonNull UserHandle user) {
    public void startMainActivity(@NonNull ComponentName component,
            @NonNull UserHandle targetUser) {
        try {
            mService.startActivityAsUser(mContext.getPackageName(), component, user);
            mService.startActivityAsUser(mContext.getPackageName(), component, targetUser);
        } catch (RemoteException ex) {
            throw ex.rethrowFromSystemServer();
        }
@@ -114,7 +115,7 @@ public class CrossProfileApps {
    }

    /**
     * Return an icon that calling app can show to user for the semantic of profile switching --
     * Return a drawable that calling app can show to user for the semantic of profile switching --
     * launching its own activity in specified user profile. For example, it may return a briefcase
     * icon if the given user handle is the managed profile one.
     *
@@ -124,9 +125,9 @@ public class CrossProfileApps {
     * @return an icon that calling app can show user for the semantic of launching its own
     *         activity in specified user profile.
     *
     * @see #startMainActivity(ComponentName, UserHandle, Rect, Bundle)
     * @see #startMainActivity(ComponentName, UserHandle)
     */
    public @NonNull Drawable getProfileSwitchingIcon(@NonNull UserHandle userHandle) {
    public @NonNull Drawable getProfileSwitchingIconDrawable(@NonNull UserHandle userHandle) {
        verifyCanAccessUser(userHandle);

        final boolean isManagedProfile =
Loading