[Settings]Crashed when 3rd-party app call ZenModeScheduleRuleSettings directly
Fix the issue that some 3rd-party apps call ZenModeScheduleRuleSettings directly
without set the extra ConditionProviderService.EXTRA_RULE_ID. It will raise the
exception and make settings crash.
Test: 1. Install the app "QuickShortcutMaker"
2. Following the steps descripted in the issue:
https://issuetracker.google.com/issues/37977351
3. make ROBOTEST_FILTER="(ZenModeScheduleRuleSettingsTest)" RunSettingsRoboTests
Change-Id: Ia7de0e691eef6d0da26e629ff0c6af7006757623
Signed-off-by: liurong <liurong@xiaomi.com>
This commit is contained in:
@@ -85,6 +85,12 @@ public abstract class ZenModeRuleSettingsBase extends ZenModeSettingsBase
|
||||
}
|
||||
|
||||
mId = intent.getStringExtra(ConditionProviderService.EXTRA_RULE_ID);
|
||||
if (mId == null) {
|
||||
Log.w(TAG, "rule id is null");
|
||||
toastAndFinish();
|
||||
return;
|
||||
}
|
||||
|
||||
if (DEBUG) Log.d(TAG, "mId=" + mId);
|
||||
if (refreshRuleOrFinish()) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user