Files
app_Settings/src/com/android/settings/ActionDisabledByAppOpsDialog.java
Hani Kazmi 206300962f Replace ECM AppOps call with service
A new ECM service was introcuded in changeId
I831391e4437b51b3312b5273a2360bd029a3d8ee.

We begin calling it, and update/cleanup method signatures to match.

Note: There are two feature flags:

1. enhancedConfirmationModeApisEnabled - read only, protects the
   mainline API.

2. extendEcmToAllSettings - runtime - gates calls to the above APIs.

We use both so we can ramp up in teamfood as needed.

Bug: 297372999
Test: Tested on device
Test: atest SpaPrivilegedLibTests
Test: atest com.android.settings.applications.specialaccess.notificationaccess
Test: atest com.android.settings.datausage
Test: atest PremiumSmsAccessTest
Test: atest RestrictedPreferenceHelperTest
Change-Id: I945ec51df5cd63de548a8ffdd1acc4f09f2301e5
2024-02-21 14:43:02 +00:00

65 lines
2.1 KiB
Java

/*
* Copyright (C) 2018 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;
import android.app.Activity;
import android.app.AppOpsManager;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
public class ActionDisabledByAppOpsDialog extends Activity
implements DialogInterface.OnDismissListener {
private static final String TAG = "ActionDisabledByAppOpsDialog";
private ActionDisabledByAppOpsHelper mDialogHelper;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mDialogHelper = new ActionDisabledByAppOpsHelper(this);
mDialogHelper.prepareDialogBuilder()
.setOnDismissListener(this)
.show();
updateAppOps();
}
private void updateAppOps() {
final Intent intent = getIntent();
final String packageName = intent.getStringExtra(Intent.EXTRA_PACKAGE_NAME);
final int uid = intent.getIntExtra(Intent.EXTRA_UID, android.os.Process.INVALID_UID);
getSystemService(AppOpsManager.class)
.setMode(AppOpsManager.OP_ACCESS_RESTRICTED_SETTINGS,
uid,
packageName,
AppOpsManager.MODE_IGNORED);
}
@Override
public void onNewIntent(Intent intent) {
super.onNewIntent(intent);
mDialogHelper.updateDialog();
updateAppOps();
}
@Override
public void onDismiss(DialogInterface dialog) {
finish();
}
}