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

Commit ee168ad8 authored by Flavio Fiszman's avatar Flavio Fiszman Committed by Android (Google) Code Review
Browse files

Merge "Creates PeopleManager API isConversation" into sc-dev

parents a5d01d30 d243c60e
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -197,6 +197,7 @@ package android {
    field public static final String READ_INSTALL_SESSIONS = "android.permission.READ_INSTALL_SESSIONS";
    field public static final String READ_NETWORK_USAGE_HISTORY = "android.permission.READ_NETWORK_USAGE_HISTORY";
    field public static final String READ_OEM_UNLOCK_STATE = "android.permission.READ_OEM_UNLOCK_STATE";
    field public static final String READ_PEOPLE_DATA = "android.permission.READ_PEOPLE_DATA";
    field public static final String READ_PRINT_SERVICES = "android.permission.READ_PRINT_SERVICES";
    field public static final String READ_PRINT_SERVICE_RECOMMENDATIONS = "android.permission.READ_PRINT_SERVICE_RECOMMENDATIONS";
    field public static final String READ_PRIVILEGED_PHONE_STATE = "android.permission.READ_PRIVILEGED_PHONE_STATE";
@@ -1275,6 +1276,14 @@ package android.app.job {
}
package android.app.people {
  public final class PeopleManager {
    method @RequiresPermission(android.Manifest.permission.READ_PEOPLE_DATA) public boolean isConversation(@NonNull String, @NonNull String);
  }
}
package android.app.prediction {
  public final class AppPredictionContext implements android.os.Parcelable {
+3 −0
Original line number Diff line number Diff line
@@ -49,6 +49,9 @@ interface IPeopleManager {
    /** Removes all the recent conversations and uncaches their cached shortcuts. */
    void removeAllRecentConversations();

    /** Returns whether the shortcutId is backed by a Conversation in People Service. */
    boolean isConversation(in String packageName, int userId, in String shortcutId);

    /**
     * Returns the last interaction with the specified conversation. If the
     * conversation can't be found or no interactions have been recorded, returns 0L.
+29 −0
Original line number Diff line number Diff line
@@ -17,6 +17,8 @@
package android.app.people;

import android.annotation.NonNull;
import android.annotation.RequiresPermission;
import android.annotation.SystemApi;
import android.annotation.SystemService;
import android.content.Context;
import android.content.pm.ParceledListSlice;
@@ -53,6 +55,33 @@ public final class PeopleManager {
                Context.PEOPLE_SERVICE));
    }

    /**
     * Returns whether a shortcut has a conversation associated.
     *
     * <p>Requires android.permission.READ_PEOPLE_DATA permission.
     *
     * <p>This method may return different results for the same shortcut over time, as an app adopts
     * conversation features or if a user hasn't communicated with the conversation associated to
     * the shortcut in a while, so the result should not be stored and relied on indefinitely by
     * clients.
     *
     * @param packageName name of the package the conversation is part of
     * @param shortcutId the shortcut id backing the conversation
     * @return whether the {@shortcutId} is backed by a Conversation.
     *
     * @hide
     */
    @SystemApi
    @RequiresPermission(android.Manifest.permission.READ_PEOPLE_DATA)
    public boolean isConversation(@NonNull String packageName, @NonNull String shortcutId) {
        Preconditions.checkStringNotEmpty(packageName);
        Preconditions.checkStringNotEmpty(shortcutId);
        try {
            return mService.isConversation(packageName, mContext.getUserId(), shortcutId);
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }

    /**
     * Sets or updates a {@link ConversationStatus} for a conversation.
+6 −0
Original line number Diff line number Diff line
@@ -5496,6 +5496,12 @@
    <permission android:name="android.permission.GET_PEOPLE_TILE_PREVIEW"
        android:protectionLevel="signature|recents" />

    <!-- @hide @SystemApi Allows an application to retrieve whether shortcut is backed by a
         Conversation.
         TODO(b/180412052): STOPSHIP: Define a role so it can be granted to Shell and AiAi. -->
    <permission android:name="android.permission.READ_PEOPLE_DATA"
                android:protectionLevel="signature|appPredictor|recents"/>

    <!-- Attribution for Geofencing service. -->
    <attribution android:tag="GeofencingService" android:label="@string/geofencing_service"/>
    <!-- Attribution for Country Detector. -->
+2 −0
Original line number Diff line number Diff line
@@ -478,6 +478,8 @@ applications that come with the platform
        <permission name="android.permission.CAPTURE_AUDIO_HOTWORD" />
        <!-- Permission required for CTS test - CtsRebootReadinessTestCases -->
        <permission name="android.permission.SIGNAL_REBOOT_READINESS" />
        <!-- Permission required for CTS test - PeopleManagerTest -->
        <permission name="android.permission.READ_PEOPLE_DATA" />
    </privapp-permissions>

    <privapp-permissions package="com.android.statementservice">
Loading