Return back-up slices for unavailable settings

When an inline slice is requested, and the setting is unavailable,
we should present more useful information to the user. This CL handles:
- Unsupported: return intent slice to Settings home page
- Disabled for user: intent to the setting page
- Unknown reason: intent to setting page
- Disabled dependency: Create intent-based Slice rather
than the requested inline slice.

Bug: 71640747
Test: robotests
Change-Id: I9c1a0ee36119d4f9f3b205e0824c251f4356db55
This commit is contained in:
Matthew Fritze
2018-02-28 10:31:06 -08:00
parent 80bf63a2dd
commit fcdfc2d83f
6 changed files with 187 additions and 18 deletions

View File

@@ -0,0 +1,21 @@
package com.android.settings.slices;
import android.content.Context;
import android.provider.Settings;
import com.android.settings.core.BasePreferenceController;
public class FakeUnavailablePreferenceController extends BasePreferenceController {
public static final String AVAILABILITY_KEY = "fake_availability_key";
public FakeUnavailablePreferenceController(Context context) {
super(context, "key");
}
@Override
public int getAvailabilityStatus() {
return Settings.System.getInt(mContext.getContentResolver(),
AVAILABILITY_KEY, 0);
}
}