diff options
author | android-build-team Robot <android-build-team-robot@google.com> | 2019-02-28 04:01:38 +0000 |
---|---|---|
committer | android-build-team Robot <android-build-team-robot@google.com> | 2019-02-28 04:01:38 +0000 |
commit | 2c62a32554bd773ff74600ddb4d7e8dac9c5e8bf (patch) | |
tree | 3f2f11b41d9b2997e361511ae36a0ed62672c4ca | |
parent | 6e0fc410f6b1c97ebb9c0886b087bf59544c8aa7 (diff) | |
parent | 0f5c3ace687e104d4333807c057936dbd2a4298e (diff) | |
download | android_packages_providers_CalendarProvider-2c62a32554bd773ff74600ddb4d7e8dac9c5e8bf.tar.gz android_packages_providers_CalendarProvider-2c62a32554bd773ff74600ddb4d7e8dac9c5e8bf.tar.bz2 android_packages_providers_CalendarProvider-2c62a32554bd773ff74600ddb4d7e8dac9c5e8bf.zip |
Snap for 5342135 from 0f5c3ace687e104d4333807c057936dbd2a4298e to qt-release
Change-Id: I35c012c16e0d0b503d831a64cf6c826c3e9c5f4d
-rw-r--r-- | src/com/android/providers/calendar/CalendarProvider2.java | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/com/android/providers/calendar/CalendarProvider2.java b/src/com/android/providers/calendar/CalendarProvider2.java index 91610ea..c4d12bb 100644 --- a/src/com/android/providers/calendar/CalendarProvider2.java +++ b/src/com/android/providers/calendar/CalendarProvider2.java @@ -862,8 +862,9 @@ public class CalendarProvider2 extends SQLiteContentProvider implements OnAccoun if (parent == null) { continue; // No parent. } - // Check if it's linked to the current user. - if (parent.id == currentUserId) { + // Check if it's linked to the current user, and if work profile is disabled. + if (parent.id == currentUserId + && !userManager.isQuietModeEnabled(UserHandle.of(userInfo.id))) { return userInfo; } } @@ -891,7 +892,8 @@ public class CalendarProvider2 extends SQLiteContentProvider implements OnAccoun */ private boolean canAccessCrossProfileCalendar(int workProfileUserId) { // The criteria include: - // 1. There exists a work profile linked to the current user. + // 1. There exists a work profile linked to the current user and the work profile is not + // disabled. // 2. Profile owner of the work profile has allowed the calling package for cross // profile calendar. // 3. CROSS_PROFILE_CALENDAR_ENABLED is turned on in Settings. @@ -920,8 +922,9 @@ public class CalendarProvider2 extends SQLiteContentProvider implements OnAccoun remoteUri = Uri.withAppendedPath(remoteUri, segment); } } - return getContext().getContentResolver().query(remoteUri, projection, selection, - selectionArgs, sortOrder); + final Cursor cursor = getContext().getContentResolver().query(remoteUri, projection, + selection, selectionArgs, sortOrder); + return cursor == null ? createEmptyCursor(projection) : cursor; } private Cursor queryInternal(Uri uri, String[] projection, String selection, |