1 /* 2 * Copyright (C) 2023 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.server.wm; 18 19 import android.annotation.NonNull; 20 import android.annotation.Nullable; 21 import android.annotation.SystemApi; 22 import android.annotation.UserIdInt; 23 import android.content.ContentResolver; 24 import android.content.pm.ApplicationInfo; 25 import android.content.pm.PackageInfo; 26 import android.content.pm.PackageManager; 27 import android.content.pm.PackageManager.PackageInfoFlags; 28 import android.os.UserHandle; 29 import android.provider.Settings; 30 import android.util.Pair; 31 32 import java.util.List; 33 34 /** 35 * Interface implemented by {@link com.android.server.wm.CarDisplayCompatScaleProvider} and 36 * used by {@link CarDisplayCompatScaleProviderUpdatable}. 37 * 38 * @hide 39 */ 40 @SystemApi(client = SystemApi.Client.MODULE_LIBRARIES) 41 public interface CarDisplayCompatScaleProviderInterface { 42 /** 43 * @return a pair of the current userId and the target userId. 44 * The target userId is the user to switch during switching the driver, 45 * or {@link android.os.UserHandle.USER_NULL}. 46 * 47 * See {@link android.app.ActivityManagerInternal#getCurrentAndTargetUserIds} 48 */ getCurrentAndTargetUserIds()49 @NonNull Pair<Integer, Integer> getCurrentAndTargetUserIds(); 50 51 /** 52 * Returns the main display id assigned to the user, or {@code Display.INVALID_DISPLAY} if the 53 * user is not assigned to any main display. 54 * See {@link com.android.server.pm.UserManagerInternal#getMainDisplayAssignedToUser(int)} for 55 * the detail. 56 */ getMainDisplayAssignedToUser(@serIdInt int userId)57 int getMainDisplayAssignedToUser(@UserIdInt int userId); 58 59 /** 60 * See {@link PackageManager#getPackageInfoAsUser(String, PackageInfoFlags, int)} for details. 61 */ 62 @Nullable getPackageInfoAsUser(@onNull String packageName, @NonNull PackageInfoFlags flags, @UserIdInt int userId)63 PackageInfo getPackageInfoAsUser(@NonNull String packageName, 64 @NonNull PackageInfoFlags flags, @UserIdInt int userId) 65 throws PackageManager.NameNotFoundException; 66 67 /** 68 * See {@link PackageManager#getInstalledApplicationsAsUser(PackageManager.ApplicationInfoFlags, 69 * int)} for details. 70 */ 71 @NonNull getInstalledApplicationsAsUser( @onNull PackageManager.ApplicationInfoFlags flags, @UserIdInt int userId)72 List<ApplicationInfo> getInstalledApplicationsAsUser( 73 @NonNull PackageManager.ApplicationInfoFlags flags, @UserIdInt int userId); 74 75 /** 76 * See {@link Settings.Secure#getStringForUser(ContentResolver, String, int)} 77 */ 78 @Nullable getStringForUser(ContentResolver resolver, String name, @UserIdInt int userId)79 String getStringForUser(ContentResolver resolver, String name, @UserIdInt int userId); 80 81 /** 82 * See {@link Settings.Secure#setStringForUser(ContentResolver, String, String, int)} 83 */ putStringForUser(ContentResolver resolver, String name, String value, @UserIdInt int userId)84 boolean putStringForUser(ContentResolver resolver, String name, String value, 85 @UserIdInt int userId); 86 87 /** 88 * Returns the compat mode scale if framework already set a scaling for this package. 89 * see {@link CompatChanges#isChangeEnabled} 90 */ getCompatModeScalingFactor(@onNull String packageName, @NonNull UserHandle userHandle)91 float getCompatModeScalingFactor(@NonNull String packageName, 92 @NonNull UserHandle userHandle); 93 } 94