feat(A11yFeedback): Add feedback entry for Accessibility page
This entry point allows users to access in the action bar. Visibility is controlled by the aconfig and FeedbackManager#isAvailable Bug: 393981463 Test: atest AccessibilitySettingsTest Flag: com.android.server.accessibility.enable_low_vision_generic_feedback Change-Id: I8c219b8220b5839121d14959fe526e6200afeecb
This commit is contained in:
@@ -30,6 +30,9 @@ import android.os.UserHandle;
|
||||
import android.provider.Settings;
|
||||
import android.text.TextUtils;
|
||||
import android.util.ArrayMap;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.accessibility.AccessibilityManager;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
@@ -101,6 +104,8 @@ public class AccessibilitySettings extends DashboardFragment implements
|
||||
// presentation.
|
||||
private static final long DELAY_UPDATE_SERVICES_MILLIS = 1000;
|
||||
|
||||
static final int MENU_ID_SEND_FEEDBACK = 0;
|
||||
|
||||
private final Handler mHandler = new Handler();
|
||||
|
||||
private final Runnable mUpdateRunnable = new Runnable() {
|
||||
@@ -143,8 +148,9 @@ public class AccessibilitySettings extends DashboardFragment implements
|
||||
}
|
||||
};
|
||||
|
||||
@VisibleForTesting
|
||||
AccessibilitySettingsContentObserver mSettingsContentObserver;
|
||||
private AccessibilitySettingsContentObserver mSettingsContentObserver;
|
||||
|
||||
private FeedbackManager mFeedbackManager;
|
||||
|
||||
private final Map<String, PreferenceCategory> mCategoryToPrefCategoryMap =
|
||||
new ArrayMap<>();
|
||||
@@ -245,6 +251,24 @@ public class AccessibilitySettings extends DashboardFragment implements
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreateOptionsMenu(@NonNull Menu menu, @NonNull MenuInflater inflater) {
|
||||
if (getFeedbackManager().isAvailable()) {
|
||||
menu.add(Menu.NONE, MENU_ID_SEND_FEEDBACK, Menu.NONE,
|
||||
getPrefContext().getText(R.string.accessibility_send_feedback_title));
|
||||
}
|
||||
super.onCreateOptionsMenu(menu, inflater);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
|
||||
if (item.getItemId() == MENU_ID_SEND_FEEDBACK) {
|
||||
getFeedbackManager().sendFeedback();
|
||||
return true;
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getPreferenceScreenResId() {
|
||||
return R.xml.accessibility_settings;
|
||||
@@ -255,6 +279,18 @@ public class AccessibilitySettings extends DashboardFragment implements
|
||||
return TAG;
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
void setFeedbackManager(FeedbackManager feedbackManager) {
|
||||
this.mFeedbackManager = feedbackManager;
|
||||
}
|
||||
|
||||
private FeedbackManager getFeedbackManager() {
|
||||
if (mFeedbackManager == null) {
|
||||
mFeedbackManager = new FeedbackManager(getActivity());
|
||||
}
|
||||
return mFeedbackManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the summary for the current state of this accessibilityService.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user