blob: b3423a84542eecac67a0f40bb3217a38f5a7bd43 [file] [log] [blame]
Jason Monk297c04e2018-08-23 17:16:59 -04001/*
2 * Copyright (C) 2018 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
5 * except in compliance with the License. You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software distributed under the
10 * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
11 * KIND, either express or implied. See the License for the specific language governing
12 * permissions and limitations under the License.
13 */
14
15package com.android.systemui.statusbar.phone;
16
17import static com.android.systemui.statusbar.phone.StatusBar.DEBUG;
18import static com.android.systemui.statusbar.phone.StatusBar.MULTIUSER_DEBUG;
19
20import android.service.notification.StatusBarNotification;
21import android.util.Log;
22
23import com.android.systemui.Dependency;
24import com.android.systemui.statusbar.NotificationLockscreenUserManager;
25import com.android.systemui.statusbar.NotificationMediaManager;
26import com.android.systemui.statusbar.notification.NotificationData.KeyguardEnvironment;
27import com.android.systemui.statusbar.policy.DeviceProvisionedController;
28
29public class KeyguardEnvironmentImpl implements KeyguardEnvironment {
30
31 private static final String TAG = "KeyguardEnvironmentImpl";
32
33 private final NotificationLockscreenUserManager mLockscreenUserManager =
34 Dependency.get(NotificationLockscreenUserManager.class);
35 private final DeviceProvisionedController mDeviceProvisionedController =
36 Dependency.get(DeviceProvisionedController.class);
37 private final NotificationMediaManager mMediaManager =
38 Dependency.get(NotificationMediaManager.class);
39
40 public KeyguardEnvironmentImpl() {
41 }
42
43 @Override // NotificationData.KeyguardEnvironment
44 public boolean isDeviceProvisioned() {
45 return mDeviceProvisionedController.isDeviceProvisioned();
46 }
47
48 @Override // NotificationData.KeyguardEnvironment
49 public boolean isNotificationForCurrentProfiles(StatusBarNotification n) {
50 final int notificationUserId = n.getUserId();
51 if (DEBUG && MULTIUSER_DEBUG) {
52 Log.v(TAG, String.format("%s: current userid: %d, notification userid: %d", n,
53 mLockscreenUserManager.getCurrentUserId(), notificationUserId));
54 }
55 return mLockscreenUserManager.isCurrentProfile(notificationUserId);
56 }
57}