기기 관리 구현

이 섹션에서는 관리 프로필을 위한 기기를 준비하는 데 필요한 기기 관리 기능을 사용 설정하고 확인하는 방법을 설명합니다. 기업 환경에서 매우 중요한 기기 소유자 사용 사례도 다룹니다.

관리 프로필을 사용해 작동하려면 기기에는 AOSP 코드 외에 다음 구성요소가 필요합니다.

일반 요구사항

기기 관리를 지원하려는 기기는 다음 일반 요구사항을 충족해야 합니다.

열 HAL 값

Android 7.0 이상에서는 애플리케이션이 기기 하드웨어의 상태를 쿼리하도록 사용 설정하는 기기 모니터링 및 상태 보고 API인 HardwarePropertiesManager API가 지원됩니다. 이 API는 android.os.HardwarePropertiesManager를 통해 노출되고 HardwarePropertiesManagerService를 통해 하드웨어 열 HAL(hardware/libhardware/include/hardware/thermal.h)을 호출합니다. 이는 보호 대상 API로, 기기/프로필 소유자 기기 정책 컨트롤러(DPC) 애플리케이션과 현재 VrListenerService만 이 API를 호출할 수 있습니다.

HardwarePropertiesManager API를 지원하기 위해서는 기기 열 HAL을 구현하면 다음 값을 보고할 수 있어야 합니다.

보고 범위 수행 작업
[CPU|GPU|배터리|기기 스킨] 온도 구성요소의 온도(섭씨) 앱에서 기기 온도와 구성요소 제한/종료 온도 확인 가능
CPU 활성/총 활성화 시간 시간(밀리초 단위) 앱에서 코어당 CPU 사용량 확인 가능
팬 속도 RPM 앱에서 팬 속도 확인 가능

구현하면 코어(또는 GPU, 배터리, 팬)가 오프라인 상태가 되거나 연결/연결 해제된 경우 보고 값 상황을 올바르게 처리해야 합니다.

기기 관리 사용 설정

기기 관리를 사용 설정하려면 다음 uses-features가 선언되었는지 확인합니다.

  • android.software.device_admin
  • android.software.managed_users(기기에 메모리가 2GB 이상인 경우에만 기능이 선언됨)

이러한 uses-feature 값이 기기에서 선언되었는지 확인하려면 adb shell pm list features를 실행하세요.

필수 앱만

기본적으로 프로필의 수정 작업에 필요한 애플리케이션만 관리 기기 프로비저닝의 일부로 활성화해야 합니다. 아래 _managed_profile.xml 파일의 인스턴스 예는 모두 android.software.managed_users가 선언된 경우에만 관련이 있습니다. OEM은 다음을 수정하여 관리 프로필 또는 기기에 필요한 애플리케이션이 모두 있는지 확인해야 합니다.

vendor_required_apps_managed_profile.xml
vendor_required_apps_managed_device.xml
vendor_disallowed_apps_managed_profile.xml
vendor_disallowed_apps_managed_device.xml
/*
 * The following are for Android 9 and higher only
 */
vendor_required_apps_managed_user.xml
vendor_disallowed_apps_managed_user.xml

관리 사용자에게 필요한 앱 및 허용되지 않는 앱은 DevicePolicyManager#createAndManageUser를 통해 생성된 보조 사용자에게 적용됩니다.

Nexus 기기의 예

Android 8.x 이전

pacakages/apps/ManagedProvisioning/res/values/vendor_required_apps_managed_device.xml

Android 9 이상

frameworks/base/core/res/res/values/vendor_required_apps_managed_device.xml
<resources>
  <!-- A list of apps to be retained on the managed device -->
  <string-array name="vendor_required_apps_managed_device">
    <item>com.android.vending</item> <!--­Google Play -->
    <item>com.google.android.gms</item> <!--­Required by Play -->
    <item>com.google.android.contacts</item> <!--­Google or OEM Contacts­-->
    <item>com.google.android.googlequicksearchbox</item> <!--­Google Launcher -->
    <item>com.google.android.launcher</item> <!--­Google Launcher or OEM Launcher -->
    <item>com.google.android.dialer</item> <!--­Google or OEM dialer to enable making phone calls -->
  </string-array>
</resources>

Android 8.x 이전

packages/apps/ManagedProvisioning/res/values/vendor_required_apps_managed_profile.xml

Android 9 이상

frameworks/base/core/res/res/values/vendor_required_apps_managed_profile.xml
<resources>
    <!-- A list of apps to be retained in the managed profile. This includes any Google experience apps required. -->
    <string-array name="vendor_required_apps_managed_profile">
        <item>com.android.vending</item> <!-- Google Play -->
        <item>com.google.android.gms</item> <!-- Required by Play -->
        <item>com.google.android.contacts</item> <!-- Google or OEM Contacts -->
    </string-array>
</resources>

런처 요구사항

아이콘 배지(관리 애플리케이션을 나타내기 위해 AOSP에서 제공됨) 및 기타 배지 사용자 인터페이스 요소(예: 최근 항목, 알림)가 포함된 배지 설정 애플리케이션을 지원하려면 런처를 업데이트해야 합니다. AOSP에서 launcher3를 수정하지 않고 사용하면 배지 설정 기능을 이미 지원하고 있을 수 있습니다.

NFC 요구사항

NFC를 사용하는 기기는 구매 직후 환경(즉, 설정 마법사)에서 NFC를 사용 설정해야 하며, 관리 프로비저닝 인텐트를 수락하도록 구성되어야 합니다.

packages/apps/Nfc/res/values/provisioning.xml
<bool name="enable_nfc_provisioning">true</bool>
<item>application/com.android.managedprovisioning</item>

설정 요구사항

구매 직후 환경(즉, 설정 마법사)이 포함된 기기는 기기 소유자 프로비저닝을 구현해야 합니다. 구매 직후 환경이 시작되면 다른 프로세스(예: 기기 소유자 프로비저닝)가 이미 사용자 설정을 완료했는지 확인하고, 완료한 경우에는 홈 인텐트를 실행하고 설정을 완료해야 합니다. 홈 인텐트는 프로비저닝 애플리케이션이 포착하며, 그런 다음 새로 설정된 기기 소유자에게 제어권을 넘깁니다.

설정 요구사항을 충족하려면 기기 설정의 기본 활동에 다음 코드를 추가하세요.

@Override
   protected void onStart() {
        super.onStart();

        // When returning to a setup wizard activity, check to see if another setup process
        // has intervened and, if so, complete an orderly exit
        boolean completed = Settings.Secure.getInt(getContentResolver(),
                Settings.Secure.USER_SETUP_COMPLETE, 0) != 0;
        if (completed) {
           startActivity(new Intent(Intent.ACTION_MAIN, null)
                .addCategory(Intent.CATEGORY_HOME)
                .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK
                        | Intent.FLAG_ACTIVITY_CLEAR_TASK
                        | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED));
           finish();
       }

       ...
   }