Loading core/java/com/android/internal/config/sysui/SystemUiDeviceConfigFlags.java +6 −0 Original line number Diff line number Diff line Loading @@ -414,6 +414,12 @@ public final class SystemUiDeviceConfigFlags { */ public static final String CHOOSER_TARGET_RANKING_ENABLED = "chooser_target_ranking_enabled"; /** * (boolean) Whether dark launch of remote prediction service is enabled. */ public static final String DARK_LAUNCH_REMOTE_PREDICTION_SERVICE_ENABLED = "dark_launch_remote_prediction_service_enabled"; /** * (boolean) Whether to enable pinch resizing for PIP. */ Loading services/appprediction/java/com/android/server/appprediction/AppPredictionManagerService.java +3 −1 Original line number Diff line number Diff line Loading @@ -35,6 +35,7 @@ import android.content.Context; import android.content.pm.ParceledListSlice; import android.os.Binder; import android.os.IBinder; import android.os.Process; import android.os.ResultReceiver; import android.os.ShellCallback; import android.util.Slog; Loading Loading @@ -179,7 +180,8 @@ public class AppPredictionManagerService extends Context ctx = getContext(); if (!(ctx.checkCallingPermission(PACKAGE_USAGE_STATS) == PERMISSION_GRANTED || mServiceNameResolver.isTemporary(userId) || mActivityTaskManagerInternal.isCallerRecents(Binder.getCallingUid()))) { || mActivityTaskManagerInternal.isCallerRecents(Binder.getCallingUid()) || Binder.getCallingUid() == Process.SYSTEM_UID)) { String msg = "Permission Denial: " + func + " from pid=" + Binder.getCallingPid() Loading services/appprediction/java/com/android/server/appprediction/AppPredictionPerUserService.java +12 −1 Original line number Diff line number Diff line Loading @@ -40,6 +40,7 @@ import android.util.ArrayMap; import android.util.Slog; import com.android.internal.annotations.GuardedBy; import com.android.internal.config.sysui.SystemUiDeviceConfigFlags; import com.android.internal.infra.AbstractRemoteService; import com.android.server.LocalServices; import com.android.server.infra.AbstractPerUserSystemService; Loading @@ -55,6 +56,8 @@ public class AppPredictionPerUserService extends private static final String TAG = AppPredictionPerUserService.class.getSimpleName(); private static final String PREDICT_USING_PEOPLE_SERVICE_PREFIX = "predict_using_people_service_"; private static final String REMOTE_APP_PREDICTOR_KEY = "remote_app_predictor"; @Nullable @GuardedBy("mLock") Loading Loading @@ -112,8 +115,16 @@ public class AppPredictionPerUserService extends @GuardedBy("mLock") public void onCreatePredictionSessionLocked(@NonNull AppPredictionContext context, @NonNull AppPredictionSessionId sessionId, @NonNull IBinder token) { final boolean usesPeopleService = DeviceConfig.getBoolean(NAMESPACE_SYSTEMUI, boolean usesPeopleService = DeviceConfig.getBoolean(NAMESPACE_SYSTEMUI, PREDICT_USING_PEOPLE_SERVICE_PREFIX + context.getUiSurface(), false); if (context.getExtras() != null && context.getExtras().getBoolean(REMOTE_APP_PREDICTOR_KEY, false) && DeviceConfig.getBoolean(NAMESPACE_SYSTEMUI, SystemUiDeviceConfigFlags.DARK_LAUNCH_REMOTE_PREDICTION_SERVICE_ENABLED, false) ) { // connect with remote AppPredictionService instead for dark launch usesPeopleService = false; } final boolean serviceExists = resolveService(sessionId, false, usesPeopleService, s -> s.onCreatePredictionSession(context, sessionId)); if (serviceExists && !mSessionInfos.containsKey(sessionId)) { Loading services/people/java/com/android/server/people/PeopleService.java +4 −2 Original line number Diff line number Diff line Loading @@ -388,9 +388,11 @@ public class PeopleService extends SystemService { private Map<AppPredictionSessionId, SessionInfo> mSessions = new ArrayMap<>(); @Override public void onCreatePredictionSession(AppPredictionContext context, public void onCreatePredictionSession(AppPredictionContext appPredictionContext, AppPredictionSessionId sessionId) { mSessions.put(sessionId, new SessionInfo(context, mDataManager, sessionId.getUserId())); mSessions.put(sessionId, new SessionInfo(appPredictionContext, mDataManager, sessionId.getUserId(), getContext())); } @Override Loading services/people/java/com/android/server/people/SessionInfo.java +3 −2 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import android.annotation.UserIdInt; import android.app.prediction.AppPredictionContext; import android.app.prediction.AppTarget; import android.app.prediction.IPredictionCallback; import android.content.Context; import android.content.pm.ParceledListSlice; import android.os.RemoteCallbackList; import android.os.RemoteException; Loading @@ -40,9 +41,9 @@ class SessionInfo { new RemoteCallbackList<>(); SessionInfo(AppPredictionContext predictionContext, DataManager dataManager, @UserIdInt int callingUserId) { @UserIdInt int callingUserId, Context context) { mAppTargetPredictor = AppTargetPredictor.create(predictionContext, this::updatePredictions, dataManager, callingUserId); this::updatePredictions, dataManager, callingUserId, context); } void addCallback(IPredictionCallback callback) { Loading Loading
core/java/com/android/internal/config/sysui/SystemUiDeviceConfigFlags.java +6 −0 Original line number Diff line number Diff line Loading @@ -414,6 +414,12 @@ public final class SystemUiDeviceConfigFlags { */ public static final String CHOOSER_TARGET_RANKING_ENABLED = "chooser_target_ranking_enabled"; /** * (boolean) Whether dark launch of remote prediction service is enabled. */ public static final String DARK_LAUNCH_REMOTE_PREDICTION_SERVICE_ENABLED = "dark_launch_remote_prediction_service_enabled"; /** * (boolean) Whether to enable pinch resizing for PIP. */ Loading
services/appprediction/java/com/android/server/appprediction/AppPredictionManagerService.java +3 −1 Original line number Diff line number Diff line Loading @@ -35,6 +35,7 @@ import android.content.Context; import android.content.pm.ParceledListSlice; import android.os.Binder; import android.os.IBinder; import android.os.Process; import android.os.ResultReceiver; import android.os.ShellCallback; import android.util.Slog; Loading Loading @@ -179,7 +180,8 @@ public class AppPredictionManagerService extends Context ctx = getContext(); if (!(ctx.checkCallingPermission(PACKAGE_USAGE_STATS) == PERMISSION_GRANTED || mServiceNameResolver.isTemporary(userId) || mActivityTaskManagerInternal.isCallerRecents(Binder.getCallingUid()))) { || mActivityTaskManagerInternal.isCallerRecents(Binder.getCallingUid()) || Binder.getCallingUid() == Process.SYSTEM_UID)) { String msg = "Permission Denial: " + func + " from pid=" + Binder.getCallingPid() Loading
services/appprediction/java/com/android/server/appprediction/AppPredictionPerUserService.java +12 −1 Original line number Diff line number Diff line Loading @@ -40,6 +40,7 @@ import android.util.ArrayMap; import android.util.Slog; import com.android.internal.annotations.GuardedBy; import com.android.internal.config.sysui.SystemUiDeviceConfigFlags; import com.android.internal.infra.AbstractRemoteService; import com.android.server.LocalServices; import com.android.server.infra.AbstractPerUserSystemService; Loading @@ -55,6 +56,8 @@ public class AppPredictionPerUserService extends private static final String TAG = AppPredictionPerUserService.class.getSimpleName(); private static final String PREDICT_USING_PEOPLE_SERVICE_PREFIX = "predict_using_people_service_"; private static final String REMOTE_APP_PREDICTOR_KEY = "remote_app_predictor"; @Nullable @GuardedBy("mLock") Loading Loading @@ -112,8 +115,16 @@ public class AppPredictionPerUserService extends @GuardedBy("mLock") public void onCreatePredictionSessionLocked(@NonNull AppPredictionContext context, @NonNull AppPredictionSessionId sessionId, @NonNull IBinder token) { final boolean usesPeopleService = DeviceConfig.getBoolean(NAMESPACE_SYSTEMUI, boolean usesPeopleService = DeviceConfig.getBoolean(NAMESPACE_SYSTEMUI, PREDICT_USING_PEOPLE_SERVICE_PREFIX + context.getUiSurface(), false); if (context.getExtras() != null && context.getExtras().getBoolean(REMOTE_APP_PREDICTOR_KEY, false) && DeviceConfig.getBoolean(NAMESPACE_SYSTEMUI, SystemUiDeviceConfigFlags.DARK_LAUNCH_REMOTE_PREDICTION_SERVICE_ENABLED, false) ) { // connect with remote AppPredictionService instead for dark launch usesPeopleService = false; } final boolean serviceExists = resolveService(sessionId, false, usesPeopleService, s -> s.onCreatePredictionSession(context, sessionId)); if (serviceExists && !mSessionInfos.containsKey(sessionId)) { Loading
services/people/java/com/android/server/people/PeopleService.java +4 −2 Original line number Diff line number Diff line Loading @@ -388,9 +388,11 @@ public class PeopleService extends SystemService { private Map<AppPredictionSessionId, SessionInfo> mSessions = new ArrayMap<>(); @Override public void onCreatePredictionSession(AppPredictionContext context, public void onCreatePredictionSession(AppPredictionContext appPredictionContext, AppPredictionSessionId sessionId) { mSessions.put(sessionId, new SessionInfo(context, mDataManager, sessionId.getUserId())); mSessions.put(sessionId, new SessionInfo(appPredictionContext, mDataManager, sessionId.getUserId(), getContext())); } @Override Loading
services/people/java/com/android/server/people/SessionInfo.java +3 −2 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import android.annotation.UserIdInt; import android.app.prediction.AppPredictionContext; import android.app.prediction.AppTarget; import android.app.prediction.IPredictionCallback; import android.content.Context; import android.content.pm.ParceledListSlice; import android.os.RemoteCallbackList; import android.os.RemoteException; Loading @@ -40,9 +41,9 @@ class SessionInfo { new RemoteCallbackList<>(); SessionInfo(AppPredictionContext predictionContext, DataManager dataManager, @UserIdInt int callingUserId) { @UserIdInt int callingUserId, Context context) { mAppTargetPredictor = AppTargetPredictor.create(predictionContext, this::updatePredictions, dataManager, callingUserId); this::updatePredictions, dataManager, callingUserId, context); } void addCallback(IPredictionCallback callback) { Loading