diff options
author | Nate Myren <ntmyren@google.com> | 2019-11-01 14:36:47 -0700 |
---|---|---|
committer | Nate Myren <ntmyren@google.com> | 2019-11-01 21:39:08 +0000 |
commit | 6ac1ace3308b35619c5067c012ddada80bc7b362 (patch) | |
tree | 1c7129dfe8c50ea398be71a956ba983a232e8ada /PermissionController/src/com/android/permissioncontroller/DeviceUtils.java | |
parent | df9488fa1f42971057fe9f3ea43b6b5f7149acf9 (diff) | |
download | Permission-6ac1ace3308b35619c5067c012ddada80bc7b362.tar.gz |
Refactor packageinstaller to permissioncontroller V2
renamed "packageinstaller" package to "permissioncontroller"
Fixes: 141707344
Test: flash new permissioncontroller, ensure UI still functions
correctly.
Change-Id: Ib58c0486cf148d1ca3167fdf8cb6d185eef78f64
Diffstat (limited to 'PermissionController/src/com/android/permissioncontroller/DeviceUtils.java')
-rw-r--r-- | PermissionController/src/com/android/permissioncontroller/DeviceUtils.java | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/PermissionController/src/com/android/permissioncontroller/DeviceUtils.java b/PermissionController/src/com/android/permissioncontroller/DeviceUtils.java new file mode 100644 index 000000000..60caf888c --- /dev/null +++ b/PermissionController/src/com/android/permissioncontroller/DeviceUtils.java @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2015 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 com.android.permissioncontroller; + +import android.content.Context; +import android.content.pm.PackageManager; +import android.content.res.Configuration; + +public class DeviceUtils { + public static boolean isTelevision(Context context) { + int uiMode = context.getResources().getConfiguration().uiMode; + return (uiMode & Configuration.UI_MODE_TYPE_MASK) == Configuration.UI_MODE_TYPE_TELEVISION; + } + + public static boolean isWear(final Context context) { + return context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_WATCH); + } + + public static boolean isAuto(Context context) { + return context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_AUTOMOTIVE); + } +} |