blob: 90f6c21dab73040018937fde13b312337026e1e4 [file] [log] [blame]
Maurice Lamecd2b7b2014-12-01 10:41:49 -08001/*
2 * Copyright (C) 2014 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License
15 */
16
17package com.android.settings;
18
Maurice Lam957fc672017-03-30 16:18:08 -070019import android.content.ComponentName;
20import android.content.Context;
Maurice Lamecd2b7b2014-12-01 10:41:49 -080021import android.content.Intent;
Maurice Lam957fc672017-03-30 16:18:08 -070022import android.content.pm.PackageManager;
Maurice Lam25e30812015-06-04 17:17:07 -070023
24import com.android.settings.notification.RedactionInterstitial;
Maurice Lamecd2b7b2014-12-01 10:41:49 -080025
26/**
27 * Setup Wizard's version of RedactionInterstitial screen. It inherits the logic and basic structure
28 * from RedactionInterstitial class, and should remain similar to that behaviorally. This class
29 * should only overload base methods for minor theme and behavior differences specific to Setup
30 * Wizard. Other changes should be done to RedactionInterstitial class instead and let this class
31 * inherit those changes.
32 */
Maurice Lam83301b52015-04-18 20:11:59 -070033public class SetupRedactionInterstitial extends RedactionInterstitial {
Maurice Lamecd2b7b2014-12-01 10:41:49 -080034
Maurice Lam957fc672017-03-30 16:18:08 -070035 /**
36 * Set the enabled state of SetupRedactionInterstitial activity to configure whether it is shown
37 * as part of setup wizard's optional steps.
38 */
39 public static void setEnabled(Context context, boolean enabled) {
40 PackageManager packageManager = context.getPackageManager();
41 ComponentName componentName = new ComponentName(context, SetupRedactionInterstitial.class);
42 packageManager.setComponentEnabledSetting(
43 componentName,
44 enabled ? PackageManager.COMPONENT_ENABLED_STATE_ENABLED
45 : PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
46 PackageManager.DONT_KILL_APP);
47 }
48
Maurice Lamecd2b7b2014-12-01 10:41:49 -080049 @Override
50 public Intent getIntent() {
51 Intent modIntent = new Intent(super.getIntent());
52 modIntent.putExtra(EXTRA_SHOW_FRAGMENT,
Udam Sainidd05ab72016-03-21 17:35:08 -070053 SetupRedactionInterstitialFragment.class.getName());
Maurice Lamecd2b7b2014-12-01 10:41:49 -080054 return modIntent;
55 }
56
57 @Override
58 protected boolean isValidFragment(String fragmentName) {
Udam Sainidd05ab72016-03-21 17:35:08 -070059 return SetupRedactionInterstitialFragment.class.getName().equals(fragmentName);
Maurice Lamecd2b7b2014-12-01 10:41:49 -080060 }
61
Maurice Lamd189ac52016-06-15 13:39:34 -070062 public static class SetupRedactionInterstitialFragment extends RedactionInterstitialFragment {
Udam Saini71fde522016-03-30 13:38:05 -070063
Maurice Lamd189ac52016-06-15 13:39:34 -070064 // Setup wizard specific UI customizations can be done here
Maurice Lamecd2b7b2014-12-01 10:41:49 -080065 }
66}