2016-01-22 17:48:29 +00:00
|
|
|
/*
|
|
|
|
|
* Copyright (C) 2016 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.launcher3.compat;
|
|
|
|
|
|
2016-07-28 12:11:54 -07:00
|
|
|
import android.annotation.TargetApi;
|
2016-01-22 17:48:29 +00:00
|
|
|
import android.content.Context;
|
2016-07-28 12:11:54 -07:00
|
|
|
import android.os.Build;
|
2018-01-15 14:52:47 +00:00
|
|
|
import android.os.Process;
|
2016-12-15 15:53:17 -08:00
|
|
|
import android.os.UserHandle;
|
2016-08-31 13:12:40 -07:00
|
|
|
|
2018-01-15 14:52:47 +00:00
|
|
|
import java.util.List;
|
|
|
|
|
|
2016-07-28 12:11:54 -07:00
|
|
|
@TargetApi(Build.VERSION_CODES.N)
|
2016-08-31 14:15:40 -07:00
|
|
|
public class UserManagerCompatVN extends UserManagerCompatVM {
|
2016-01-22 17:48:29 +00:00
|
|
|
|
|
|
|
|
UserManagerCompatVN(Context context) {
|
|
|
|
|
super(context);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
2016-12-15 15:53:17 -08:00
|
|
|
public boolean isQuietModeEnabled(UserHandle user) {
|
|
|
|
|
return mUserManager.isQuietModeEnabled(user);
|
2016-07-28 12:11:54 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
2016-12-15 15:53:17 -08:00
|
|
|
public boolean isUserUnlocked(UserHandle user) {
|
|
|
|
|
return mUserManager.isUserUnlocked(user);
|
2016-08-31 13:12:40 -07:00
|
|
|
}
|
2018-01-15 14:52:47 +00:00
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public boolean isAnyProfileQuietModeEnabled() {
|
|
|
|
|
List<UserHandle> userProfiles = getUserProfiles();
|
|
|
|
|
for (UserHandle userProfile : userProfiles) {
|
|
|
|
|
if (Process.myUserHandle().equals(userProfile)) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if (isQuietModeEnabled(userProfile)) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2016-01-22 17:48:29 +00:00
|
|
|
}
|
|
|
|
|
|