Exploit databaseDownload repository ZIP
GH-f017d6af0c230973ee42a29dbf9b6daa
726232111/packages_apps_settings_aosp_10_r33_cve-2022-20360
Sources for CVE-2022-20360
1 sourcePreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars.
Repository files166
726232111/packages_apps_settings_aosp_10_r33_cve-2022-20360Revision 570f2fb71afd
- ↑..Parent directory
- AbstractZenCustomRulePreferenceController.java
- AbstractZenModeAutomaticRulePreferenceController.java
- AbstractZenModePreferenceController.java
- AdjustVolumeRestrictedPreferenceController.java
- AlarmRingtonePreferenceController.java
- AlarmVolumePreferenceController.java
- AllowSoundPreferenceController.java
- AppBubbleNotificationSettings.java
- AppLinkPreferenceController.java
- AppNotificationSettings.java
- AssistantCapabilityPreferenceController.java
- AudioHelper.java
- BadgePreferenceController.java
- BadgingNotificationPreferenceController.java
- BlockPreferenceController.java
- BootSoundPreferenceController.java
- BubblePreferenceController.java
- BubbleSummaryPreferenceController.java
- BubbleWarningDialogFragment.java
- CallVolumePreferenceController.java
- CastPreferenceController.java
- ChannelListPreferenceController.java
- ChannelNotificationSettings.java
- ChargingSoundPreferenceController.java
- ConfigureNotificationSettings.java
- DefaultNotificationTonePreference.java
- DeletedChannelsPreferenceController.java
- DescriptionPreferenceController.java
- DialPadTonePreferenceController.java
- DndPreferenceController.java
- DockAudioMediaPreferenceController.java
- DockingSoundPreferenceController.java
- EmergencyBroadcastPreferenceController.java
- EmergencyTonePreferenceController.java
- GentleNotificationsPreferenceController.java
- GlobalBubblePermissionObserverMixin.java
- HeaderPreferenceController.java
- HighImportancePreferenceController.java
- ImportancePreference.java
- ImportancePreferenceController.java
- LightsPreferenceController.java
- LockScreenNotificationPreferenceController.java
- MediaVolumePreferenceController.java
- MinImportancePreferenceController.java
- NotificationAccessConfirmationActivity.java
- NotificationAccessSettings.java
- NotificationAppPreference.java
- NotificationAssistantPicker.java
- NotificationAssistantPreferenceController.java
- NotificationBackend.java
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
src/com/android/settings/notification/ZenOnboardingActivity.java
Java · 7,786 bytes/*
* Copyright (C) 2018 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.settings.notification;
import android.app.Activity;
import android.app.NotificationManager;
import android.app.NotificationManager.Policy;
import android.app.settings.SettingsEnums;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.provider.Settings;
import android.text.format.DateUtils;
import android.util.Log;
import android.view.View;
import android.widget.RadioButton;
import androidx.annotation.VisibleForTesting;
import com.android.internal.logging.MetricsLogger;
import com.android.settings.R;
import com.android.settings.dashboard.suggestions.SuggestionFeatureProvider;
import com.android.settings.overlay.FeatureFactory;
public class ZenOnboardingActivity extends Activity {
private static final String TAG = "ZenOnboardingActivity";
@VisibleForTesting
static final String PREF_KEY_SUGGESTION_FIRST_DISPLAY_TIME =
"pref_zen_suggestion_first_display_time_ms";
@VisibleForTesting
static final long ALWAYS_SHOW_THRESHOLD = DateUtils.DAY_IN_MILLIS * 14;
View mNewSetting;
View mKeepCurrentSetting;
RadioButton mNewSettingButton;
RadioButton mKeepCurrentSettingButton;
private NotificationManager mNm;
private MetricsLogger mMetrics;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setNotificationManager(getSystemService(NotificationManager.class));
setMetricsLogger(new MetricsLogger());
Context context = getApplicationContext();
Settings.Secure.putInt(context.getContentResolver(),
Settings.Secure.ZEN_SETTINGS_SUGGESTION_VIEWED, 1);
setupUI();
}
@VisibleForTesting
protected void setupUI() {
setContentView(R.layout.zen_onboarding);
mNewSetting = findViewById(R.id.zen_onboarding_new_setting);
mKeepCurrentSetting = findViewById(R.id.zen_onboarding_current_setting);
mNewSettingButton = findViewById(R.id.zen_onboarding_new_setting_button);
mKeepCurrentSettingButton = findViewById(R.id.zen_onboarding_current_setting_button);
View.OnClickListener newSettingClickListener = new View.OnClickListener() {
@Override
public void onClick(View v) {
mKeepCurrentSettingButton.setChecked(false);
mNewSettingButton.setChecked(true);
}
};
View.OnClickListener currentSettingClickListener = new View.OnClickListener() {
@Override
public void onClick(View v) {
mKeepCurrentSettingButton.setChecked(true);
mNewSettingButton.setChecked(false);
}
};
mNewSetting.setOnClickListener(newSettingClickListener);
mNewSettingButton.setOnClickListener(newSettingClickListener);
mKeepCurrentSetting.setOnClickListener(currentSettingClickListener);
mKeepCurrentSettingButton.setOnClickListener(currentSettingClickListener);
mKeepCurrentSettingButton.setChecked(true);
mMetrics.visible(SettingsEnums.SETTINGS_ZEN_ONBOARDING);
}
@VisibleForTesting
protected void setNotificationManager(NotificationManager nm) {
mNm = nm;
}
@VisibleForTesting
protected void setMetricsLogger(MetricsLogger ml) {
mMetrics = ml;
}
public void launchSettings(View button) {
mMetrics.action(SettingsEnums.ACTION_ZEN_ONBOARDING_SETTINGS);
Intent settings = new Intent(Settings.ACTION_ZEN_MODE_SETTINGS);
settings.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
startActivity(settings);
}
public void save(View button) {
NotificationManager.Policy policy = mNm.getNotificationPolicy();
if (mNewSettingButton.isChecked()) {
NotificationManager.Policy newPolicy = new NotificationManager.Policy(
Policy.PRIORITY_CATEGORY_REPEAT_CALLERS | policy.priorityCategories,
Policy.PRIORITY_SENDERS_STARRED,
policy.priorityMessageSenders,
NotificationManager.Policy.getAllSuppressedVisualEffects());
mNm.setNotificationPolicy(newPolicy);
mMetrics.action(SettingsEnums.ACTION_ZEN_ONBOARDING_OK);
} else {
mMetrics.action(SettingsEnums.ACTION_ZEN_ONBOARDING_KEEP_CURRENT_SETTINGS);
}
Settings.Secure.putInt(getApplicationContext().getContentResolver(),
Settings.Secure.ZEN_SETTINGS_UPDATED, 1);
finishAndRemoveTask();
}
public static boolean isSuggestionComplete(Context context) {
if (wasZenUpdated(context)) {
return true;
}
if (showSuggestion(context) || withinShowTimeThreshold(context)) {
return false;
}
return true;
}
private static boolean wasZenUpdated(Context context) {
// ZEN_SETTINGS_UPDATED is true for:
// - fresh P+ device
// - if zen visual effects values were changed by the user in Settings
NotificationManager nm = context.getSystemService(NotificationManager.class);
if (NotificationManager.Policy.areAllVisualEffectsSuppressed(
nm.getNotificationPolicy().suppressedVisualEffects)) {
Settings.Secure.putInt(context.getContentResolver(),
Settings.Secure.ZEN_SETTINGS_UPDATED, 1);
}
return Settings.Secure.getInt(context.getContentResolver(),
Settings.Secure.ZEN_SETTINGS_UPDATED, 0) != 0;
}
private static boolean showSuggestion(Context context) {
// SHOW_ZEN_SETTINGS_SUGGESTION is by default true, but false when:
// - user manually turns on dnd
// SHOW_ZEN_SETTINGS_SUGGESTION is also true when:
// - automatic rule has started DND and user has not seen the first use dialog
return Settings.Secure.getInt(context.getContentResolver(),
Settings.Secure.SHOW_ZEN_SETTINGS_SUGGESTION, 0) != 0;
}
private static boolean withinShowTimeThreshold(Context context) {
final SuggestionFeatureProvider featureProvider = FeatureFactory.getFactory(context)
.getSuggestionFeatureProvider(context);
final SharedPreferences prefs = featureProvider.getSharedPrefs(context);
final long currentTimeMs = System.currentTimeMillis();
final long firstDisplayTimeMs;
if (!prefs.contains(PREF_KEY_SUGGESTION_FIRST_DISPLAY_TIME)) {
firstDisplayTimeMs = currentTimeMs;
prefs.edit().putLong(PREF_KEY_SUGGESTION_FIRST_DISPLAY_TIME, currentTimeMs).commit();
} else {
firstDisplayTimeMs = prefs.getLong(PREF_KEY_SUGGESTION_FIRST_DISPLAY_TIME, -1);
}
final long showTimeMs = firstDisplayTimeMs + ALWAYS_SHOW_THRESHOLD;
final boolean stillShow = currentTimeMs < showTimeMs;
Log.d(TAG, "still show zen suggestion based on time: " + stillShow + " showTimeMs="
+ showTimeMs);
return stillShow;
}
}