Disable SetupRedactionInterstitial when complete

When RedactionInterstitial is complete, there is no need to show the
SetupRedactionInterstitial as optional step anymore. Disable it via
package manager when RedactionInterstatial completes.

Test: Manual
Bug: 36696006
Change-Id: I3fd421d6a8a0d24d7ebbe8c1e688a10e00067f2f
This commit is contained in:
Maurice Lam
2017-03-30 16:18:08 -07:00
parent 82e2239c54
commit 957fc67af2
5 changed files with 30 additions and 19 deletions

View File

@@ -16,11 +16,11 @@
package com.android.settings;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import com.android.settings.notification.RedactionInterstitial;
@@ -33,6 +33,20 @@ import com.android.settings.notification.RedactionInterstitial;
*/
public class SetupRedactionInterstitial extends RedactionInterstitial {
/**
* Set the enabled state of SetupRedactionInterstitial activity to configure whether it is shown
* as part of setup wizard's optional steps.
*/
public static void setEnabled(Context context, boolean enabled) {
PackageManager packageManager = context.getPackageManager();
ComponentName componentName = new ComponentName(context, SetupRedactionInterstitial.class);
packageManager.setComponentEnabledSetting(
componentName,
enabled ? PackageManager.COMPONENT_ENABLED_STATE_ENABLED
: PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
PackageManager.DONT_KILL_APP);
}
@Override
public Intent getIntent() {
Intent modIntent = new Intent(super.getIntent());