Merge "Changes for renamed API" into qt-dev

This commit is contained in:
TreeHugger Robot
2019-04-10 22:22:25 +00:00
committed by Android (Google) Code Review
3 changed files with 21 additions and 22 deletions

View File

@@ -17,7 +17,6 @@
package com.android.settings.notification;
import android.content.Context;
import android.os.UserHandle;
import android.service.notification.Adjustment;
import com.android.settings.core.TogglePreferenceController;
@@ -44,7 +43,7 @@ public class AssistantCapabilityPreferenceController extends TogglePreferenceCon
@Override
public boolean isChecked() {
List<String> capabilities = mBackend.getAssistantCapabilities(mContext.getPackageName());
List<String> capabilities = mBackend.getAssistantAdjustments(mContext.getPackageName());
if (PRIORITIZER_KEY.equals(getPreferenceKey())) {
return capabilities.contains(Adjustment.KEY_IMPORTANCE);
} else if (SMART_KEY.equals(getPreferenceKey())) {
@@ -57,10 +56,10 @@ public class AssistantCapabilityPreferenceController extends TogglePreferenceCon
@Override
public boolean setChecked(boolean isChecked) {
if (PRIORITIZER_KEY.equals(getPreferenceKey())) {
mBackend.allowAssistantCapability(Adjustment.KEY_IMPORTANCE, isChecked);
mBackend.allowAssistantAdjustment(Adjustment.KEY_IMPORTANCE, isChecked);
} else if (SMART_KEY.equals(getPreferenceKey())) {
mBackend.allowAssistantCapability(Adjustment.KEY_CONTEXTUAL_ACTIONS, isChecked);
mBackend.allowAssistantCapability(Adjustment.KEY_TEXT_REPLIES, isChecked);
mBackend.allowAssistantAdjustment(Adjustment.KEY_CONTEXTUAL_ACTIONS, isChecked);
mBackend.allowAssistantAdjustment(Adjustment.KEY_TEXT_REPLIES, isChecked);
}
return true;
}

View File

@@ -339,21 +339,21 @@ public class NotificationBackend {
}
}
public void allowAssistantCapability(String capability, boolean allowed) {
public void allowAssistantAdjustment(String capability, boolean allowed) {
try {
if (allowed) {
sINM.allowAssistantCapability(capability);
sINM.allowAssistantAdjustment(capability);
} else {
sINM.disallowAssistantCapability(capability);
sINM.disallowAssistantAdjustment(capability);
}
} catch (Exception e) {
Log.w(TAG, "Error calling NoMan", e);
}
}
public List<String> getAssistantCapabilities(String pkg) {
public List<String> getAssistantAdjustments(String pkg) {
try {
return sINM.getAllowedAssistantCapabilities(pkg);
return sINM.getAllowedAssistantAdjustments(pkg);
} catch (Exception e) {
Log.w(TAG, "Error calling NoMan", e);
}