Add settings VR listener service.

Bug: 22855417
Bug: 26724891

- Adds a settings panel allowing users to toggle the
  enabled/disabled state of each VrListenerService
  component installed.
- If disabled, a VrListenerService will not be bound
  from the framework, even when requested by a VR
  application.

Change-Id: I606eb712c011d160b9fbdd3c0e8fd744c653ef07
This commit is contained in:
Ruben Brunk
2016-02-23 18:58:56 -08:00
parent 6e2b469651
commit e1c98ca821
10 changed files with 106 additions and 4 deletions

View File

@@ -95,6 +95,7 @@ public class Settings extends SettingsActivity {
public static class NotificationStationActivity extends SettingsActivity { /* empty */ }
public static class UserSettingsActivity extends SettingsActivity { /* empty */ }
public static class NotificationAccessSettingsActivity extends SettingsActivity { /* empty */ }
public static class VrListenerSettingsActivity extends SettingsActivity { /* empty */ }
public static class ZenAccessSettingsActivity extends SettingsActivity { /* empty */ }
public static class ConditionProviderSettingsActivity extends SettingsActivity { /* empty */ }
public static class UsbSettingsActivity extends SettingsActivity { /* empty */ }

View File

@@ -0,0 +1,51 @@
/*
* Copyright (C) 2016 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.applications;
import android.provider.Settings;
import android.service.vr.VrListenerService;
import com.android.internal.logging.MetricsProto.MetricsEvent;
import com.android.settings.R;
import com.android.settings.utils.ManagedServiceSettings;
public class VrListenerSettings extends ManagedServiceSettings {
private static final String TAG = VrListenerSettings.class.getSimpleName();
private static final Config CONFIG = getVrListenerConfig();
private static final Config getVrListenerConfig() {
final Config c = new Config();
c.tag = TAG;
c.setting = Settings.Secure.ENABLED_VR_LISTENERS;
c.intentAction = VrListenerService.SERVICE_INTERFACE;
c.permission = android.Manifest.permission.BIND_VR_LISTENER_SERVICE;
c.noun = "vr listener";
c.warningDialogTitle = R.string.vr_listener_security_warning_title;
c.warningDialogSummary = R.string.vr_listener_security_warning_summary;
c.emptyText = R.string.no_vr_listeners;
return c;
}
@Override
protected Config getConfig() {
return CONFIG;
}
@Override
protected int getMetricsCategory() {
return MetricsEvent.VR_MANAGE_LISTENERS;
}
}

View File

@@ -23,6 +23,8 @@ import android.service.notification.NotificationListenerService;
import com.android.internal.logging.MetricsProto.MetricsEvent;
import com.android.settings.R;
import com.android.settings.utils.ManagedServiceSettings;
import com.android.settings.utils.ServiceListing;
public class NotificationAccessSettings extends ManagedServiceSettings {
private static final String TAG = NotificationAccessSettings.class.getSimpleName();

View File

@@ -42,7 +42,8 @@ import android.view.View;
import com.android.internal.logging.MetricsLogger;
import com.android.internal.logging.MetricsProto.MetricsEvent;
import com.android.settings.R;
import com.android.settings.notification.ManagedServiceSettings.Config;
import com.android.settings.utils.ManagedServiceSettings.Config;
import com.android.settings.utils.ServiceListing;
import java.lang.ref.WeakReference;
import java.util.Arrays;

View File

@@ -35,6 +35,7 @@ import android.widget.LinearLayout;
import android.widget.TextView;
import com.android.settings.R;
import com.android.settings.utils.ServiceListing;
import java.lang.ref.WeakReference;
import java.text.Collator;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package com.android.settings.notification;
package com.android.settings.utils;
import android.annotation.Nullable;
import android.app.AlertDialog;
@@ -34,6 +34,7 @@ import android.support.v7.preference.PreferenceScreen;
import android.view.View;
import android.widget.TextView;
import com.android.settings.R;
import com.android.settings.notification.EmptyTextSettings;
import java.util.Collections;
import java.util.List;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package com.android.settings.notification;
package com.android.settings.utils;
import android.app.ActivityManager;
import android.content.BroadcastReceiver;
@@ -32,7 +32,7 @@ import android.os.Handler;
import android.provider.Settings;
import android.util.Slog;
import com.android.settings.notification.ManagedServiceSettings.Config;
import com.android.settings.utils.ManagedServiceSettings.Config;
import java.util.ArrayList;
import java.util.Arrays;