blob: 925a19d6f5eb1c715ab46beebf2f300b35d45352 [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;
Ned Burnsf81c4c42019-01-07 14:10:43 -050025import com.android.systemui.statusbar.notification.collection.NotificationData.KeyguardEnvironment;
Jason Monk297c04e2018-08-23 17:16:59 -040026import com.android.systemui.statusbar.policy.DeviceProvisionedController;
27
28public class KeyguardEnvironmentImpl implements KeyguardEnvironment {
29
30 private static final String TAG = "KeyguardEnvironmentImpl";
31
32 private final NotificationLockscreenUserManager mLockscreenUserManager =
33 Dependency.get(NotificationLockscreenUserManager.class);
34 private final DeviceProvisionedController mDeviceProvisionedController =
35 Dependency.get(DeviceProvisionedController.class);
Jason Monk297c04e2018-08-23 17:16:59 -040036
37 public KeyguardEnvironmentImpl() {
38 }
39
40 @Override // NotificationData.KeyguardEnvironment
41 public boolean isDeviceProvisioned() {
42 return mDeviceProvisionedController.isDeviceProvisioned();
43 }
44
45 @Override // NotificationData.KeyguardEnvironment
46 public boolean isNotificationForCurrentProfiles(StatusBarNotification n) {
47 final int notificationUserId = n.getUserId();
48 if (DEBUG && MULTIUSER_DEBUG) {
49 Log.v(TAG, String.format("%s: current userid: %d, notification userid: %d", n,
50 mLockscreenUserManager.getCurrentUserId(), notificationUserId));
51 }
52 return mLockscreenUserManager.isCurrentProfile(notificationUserId);
53 }
54}