chromium/ash/components/arc/mojom/app_permissions.mojom

// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// Next MinVersion: 3

module arc.mojom;

// These permissions map to ones listed at
// https://developer.android.com/reference/android/Manifest.permission
[Extensible]
enum AppPermission {
  // android.manifest.CAMERA
  CAMERA = 0,
  // android.manifest.ACCESS_{FINE|COARSE|BACKGROUND}_LOCATION
  LOCATION = 1,
  // android.manifest.RECORD_AUDIO
  MICROPHONE = 2,
  // Not a manifest permission
  NOTIFICATIONS = 3,
  // - android.manifest.READ_CONTACTS
  // - android.manifest.WRITE_CONTACTS
  CONTACTS = 4,
  // - android.manifest.{READ|WRITE}_EXTERNAL_STORAGE
  // - android.manifest.ACCESS_MEDIA_LOCATION after API level 29
  // - android.permission.READ_MEDIA_{AUDIO|IMAGES|VIDEO}, which replace
  //     {READ|WRITE}_EXTERNAL_STORAGE after API level 33
  // - android.manifest.MANAGE_EXTERNAL_STORAGE after API level 30
  STORAGE = 5,
};

// These permissions map to ones listed at
// https://developer.android.com/reference/android/Manifest.permission_group
[Extensible]
enum AppPermissionGroup {
  CAMERA          = 0, // android.permission-group.CAMERA
  MICROPHONE      = 1, // android.permission-group.MICROPHONE
  LOCATION        = 2, // android.permission-group.LOCATION
};

struct PermissionState {
  bool granted;          // If the permission has been granted
  bool managed;          // If the permission is managed by an enterprise policy

  // Optional additional human-readable details for the permission state, to be
  // shown in permission management UI surfaces. e.g. "While in use".
  [MinVersion=1] string? details;

  // When true, indicates that the current value applies for one app lifetime
  // only. The next time the app is launched, the user will be prompted again
  // about whether to allow/block the permission. This corresponds to
  // apps::TriState::kAsk in the App Service permission model.
  [MinVersion=2] bool one_time;
};

// An interface for Chrome to manipulate app permissions in ARC.
// Next method ID: 2
interface AppPermissionsInstance {
  // Grants |permission| for |package_name|.
  GrantPermission@0(string package_name, AppPermission permission);

  // Revokes |permission| for |package_name|.
  RevokePermission@1(string package_name, AppPermission permission);
};