diff options
| -rw-r--r-- | core/api/test-current.txt | 1 | ||||
| -rw-r--r-- | core/java/android/app/admin/DevicePolicyManager.java | 30 | ||||
| -rw-r--r-- | core/java/android/app/admin/IDevicePolicyManager.aidl | 1 | ||||
| -rw-r--r-- | core/res/res/values-ar/strings.xml | 2 | ||||
| -rw-r--r-- | core/res/res/values-fi/strings.xml | 2 | ||||
| -rw-r--r-- | core/res/res/values-hy/strings.xml | 2 | ||||
| -rw-r--r-- | core/res/res/values-ka/strings.xml | 2 | ||||
| -rw-r--r-- | core/res/res/values-lt/strings.xml | 4 | ||||
| -rw-r--r-- | core/res/res/values-nl/strings.xml | 4 | ||||
| -rw-r--r-- | core/res/res/values-ro/strings.xml | 2 | ||||
| -rw-r--r-- | core/res/res/values-sw/strings.xml | 8 | ||||
| -rw-r--r-- | packages/SettingsLib/res/values-ja/strings.xml | 2 | ||||
| -rw-r--r-- | services/core/java/com/android/server/wm/TaskDisplayArea.java | 64 | ||||
| -rw-r--r-- | services/core/java/com/android/server/wm/WallpaperController.java | 7 | ||||
| -rw-r--r-- | services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyData.java | 25 | ||||
| -rw-r--r-- | services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java | 44 |
16 files changed, 133 insertions, 67 deletions
diff --git a/core/api/test-current.txt b/core/api/test-current.txt index ebc62f56bc95..a80468b6d980 100644 --- a/core/api/test-current.txt +++ b/core/api/test-current.txt @@ -444,6 +444,7 @@ package android.app.admin { method @NonNull @RequiresPermission("android.permission.MANAGE_DEVICE_ADMINS") public java.util.Set<java.lang.String> getPolicyExemptApps(); method public boolean isCurrentInputMethodSetByOwner(); method public boolean isFactoryResetProtectionPolicySupported(); + method @RequiresPermission(anyOf={android.Manifest.permission.MANAGE_USERS, android.Manifest.permission.INTERACT_ACROSS_USERS}) public boolean isNewUserDisclaimerAcknowledged(); method @RequiresPermission(anyOf={"android.permission.MARK_DEVICE_ORGANIZATION_OWNED", "android.permission.MANAGE_PROFILE_AND_DEVICE_OWNERS"}, conditional=true) public void markProfileOwnerOnOrganizationOwnedDevice(@NonNull android.content.ComponentName); method @NonNull public static String operationSafetyReasonToString(int); method @NonNull public static String operationToString(int); diff --git a/core/java/android/app/admin/DevicePolicyManager.java b/core/java/android/app/admin/DevicePolicyManager.java index b949ed9d6079..a37979a2417f 100644 --- a/core/java/android/app/admin/DevicePolicyManager.java +++ b/core/java/android/app/admin/DevicePolicyManager.java @@ -3110,7 +3110,8 @@ public class DevicePolicyManager { * * @hide */ - @RequiresPermission(android.Manifest.permission.MANAGE_USERS) + @RequiresPermission(anyOf = {android.Manifest.permission.MANAGE_USERS, + android.Manifest.permission.INTERACT_ACROSS_USERS}) public void acknowledgeNewUserDisclaimer() { if (mService != null) { try { @@ -3122,6 +3123,25 @@ public class DevicePolicyManager { } /** + * Checks whether the new managed user disclaimer was viewed by the current user. + * + * @hide + */ + @RequiresPermission(anyOf = {android.Manifest.permission.MANAGE_USERS, + android.Manifest.permission.INTERACT_ACROSS_USERS}) + @TestApi + public boolean isNewUserDisclaimerAcknowledged() { + if (mService != null) { + try { + return mService.isNewUserDisclaimerAcknowledged(); + } catch (RemoteException e) { + throw e.rethrowFromSystemServer(); + } + } + return false; + } + + /** * Return true if the given administrator component is currently active (enabled) in the system. * * @param admin The administrator component to check for. @@ -6368,10 +6388,10 @@ public class DevicePolicyManager { * management app can use {@link #ID_TYPE_BASE_INFO} to request inclusion of the general device * information including manufacturer, model, brand, device and product in the attestation * record. - * Only device owner, profile owner on an organization-owned device and their delegated - * certificate installers can use {@link #ID_TYPE_SERIAL}, {@link #ID_TYPE_IMEI} and - * {@link #ID_TYPE_MEID} to request unique device identifiers to be attested (the serial number, - * IMEI and MEID correspondingly), if supported by the device + * Only device owner, profile owner on an organization-owned device or affiliated user, and + * their delegated certificate installers can use {@link #ID_TYPE_SERIAL}, {@link #ID_TYPE_IMEI} + * and {@link #ID_TYPE_MEID} to request unique device identifiers to be attested (the serial + * number, IMEI and MEID correspondingly), if supported by the device * (see {@link #isDeviceIdAttestationSupported()}). * Additionally, device owner, profile owner on an organization-owned device and their delegated * certificate installers can also request the attestation record to be signed using an diff --git a/core/java/android/app/admin/IDevicePolicyManager.aidl b/core/java/android/app/admin/IDevicePolicyManager.aidl index a2863bdfc35d..701a362b9c31 100644 --- a/core/java/android/app/admin/IDevicePolicyManager.aidl +++ b/core/java/android/app/admin/IDevicePolicyManager.aidl @@ -265,6 +265,7 @@ interface IDevicePolicyManager { void clearLogoutUser(); List<UserHandle> getSecondaryUsers(in ComponentName who); void acknowledgeNewUserDisclaimer(); + boolean isNewUserDisclaimerAcknowledged(); void enableSystemApp(in ComponentName admin, in String callerPackage, in String packageName); int enableSystemAppWithIntent(in ComponentName admin, in String callerPackage, in Intent intent); diff --git a/core/res/res/values-ar/strings.xml b/core/res/res/values-ar/strings.xml index 0c66323b1e53..2112f31e750d 100644 --- a/core/res/res/values-ar/strings.xml +++ b/core/res/res/values-ar/strings.xml @@ -1550,7 +1550,7 @@ <string name="permdesc_requestDeletePackages" msgid="6133633516423860381">"للسماح لتطبيق ما بطلب حذف الحِزم."</string> <string name="permlab_requestIgnoreBatteryOptimizations" msgid="7646611326036631439">"طلب تجاهل تحسينات البطارية"</string> <string name="permdesc_requestIgnoreBatteryOptimizations" msgid="634260656917874356">"للسماح للتطبيق بطلب الإذن لتجاهل تحسينات البطارية في هذا التطبيق."</string> - <string name="permlab_queryAllPackages" msgid="2928450604653281650">"طلب البحث في كل الحِزم"</string> + <string name="permlab_queryAllPackages" msgid="2928450604653281650">"البحث في كل الحِزم"</string> <string name="permdesc_queryAllPackages" msgid="5339069855520996010">"يسمح هذا الإذن للتطبيق بعرض كل الحِزم المثبّتة."</string> <string name="tutorial_double_tap_to_zoom_message_short" msgid="1842872462124648678">"اضغط مرتين للتحكم في التكبير أو التصغير"</string> <string name="gadget_host_error_inflating" msgid="2449961590495198720">"تعذرت إضافة أداة."</string> diff --git a/core/res/res/values-fi/strings.xml b/core/res/res/values-fi/strings.xml index a15e67131f90..6d17b1eebe5c 100644 --- a/core/res/res/values-fi/strings.xml +++ b/core/res/res/values-fi/strings.xml @@ -2009,7 +2009,7 @@ <string name="demo_restarting_message" msgid="1160053183701746766">"Palautetaan asetuksia…"</string> <string name="suspended_widget_accessibility" msgid="6331451091851326101">"<xliff:g id="LABEL">%1$s</xliff:g> ei ole käytössä."</string> <string name="conference_call" msgid="5731633152336490471">"Puhelinneuvottelu"</string> - <string name="tooltip_popup_title" msgid="7863719020269945722">"Työkaluvinkki"</string> + <string name="tooltip_popup_title" msgid="7863719020269945722">"Vihjeteksti"</string> <string name="app_category_game" msgid="4534216074910244790">"Pelit"</string> <string name="app_category_audio" msgid="8296029904794676222">"Musiikki ja ääni"</string> <string name="app_category_video" msgid="2590183854839565814">"Elokuvat ja videot"</string> diff --git a/core/res/res/values-hy/strings.xml b/core/res/res/values-hy/strings.xml index 5c01197a96eb..fc4e478543f9 100644 --- a/core/res/res/values-hy/strings.xml +++ b/core/res/res/values-hy/strings.xml @@ -537,7 +537,7 @@ <string name="permdesc_bluetooth_scan" product="default" msgid="6540723536925289276">"Թույլ է տալիս հավելվածին հայտնաբերել և զուգակցել մոտակա Bluetooth սարքերը"</string> <string name="permlab_bluetooth_connect" msgid="6657463246355003528">"միանալ զուգակցված Bluetooth սարքերի"</string> <string name="permdesc_bluetooth_connect" product="default" msgid="4546016548795544617">"Թույլ է տալիս հավելվածին միանալ զուգակցված Bluetooth սարքերի"</string> - <string name="permlab_bluetooth_advertise" msgid="2781147747928853177">"Գովազդ մոտակա Bluetooth սարքերում"</string> + <string name="permlab_bluetooth_advertise" msgid="2781147747928853177">"գովազդել մոտակա Bluetooth սարքերին"</string> <string name="permdesc_bluetooth_advertise" product="default" msgid="6085174451034210183">"Թույլատրում է հավելվածին գովազդ փոխանցել մոտակա Bluetooth սարքերին"</string> <string name="permlab_uwb_ranging" msgid="8141915781475770665">"որոշել մոտակա UWB սարքերի միջև հարաբերական դիրքավորումը"</string> <string name="permdesc_uwb_ranging" msgid="2519723069604307055">"Թույլատրել հավելվածին որոշել գերլայնաշերտ կապի տեխնոլոգիան աջակցող մոտակա սարքերի միջև հարաբերական դիրքավորումը"</string> diff --git a/core/res/res/values-ka/strings.xml b/core/res/res/values-ka/strings.xml index 9f93c7d04579..b9b7890c3548 100644 --- a/core/res/res/values-ka/strings.xml +++ b/core/res/res/values-ka/strings.xml @@ -537,7 +537,7 @@ <string name="permdesc_bluetooth_scan" product="default" msgid="6540723536925289276">"საშუალებას აძლევს აპს, აღმოაჩინოს ახლომახლო Bluetooth მოწყობილობები დასაწყვილებლად"</string> <string name="permlab_bluetooth_connect" msgid="6657463246355003528">"დაწყვილებულ Bluetooth მოწყობილობებთან დაკავშირება"</string> <string name="permdesc_bluetooth_connect" product="default" msgid="4546016548795544617">"საშუალებას აძლევს აპს, დაუკავშირდეს დაწყვილებულ Bluetooth მოწყობილობებს"</string> - <string name="permlab_bluetooth_advertise" msgid="2781147747928853177">"ახლ. Bluetooth მოწყობილობებზე რეკლამის განთავსება"</string> + <string name="permlab_bluetooth_advertise" msgid="2781147747928853177">"ახლ. Bluetooth მოწყობილობებზე მონაცემების მაუწყებლობა"</string> <string name="permdesc_bluetooth_advertise" product="default" msgid="6085174451034210183">"საშუალებას აძლევს აპს, რეკლამა განათავსოს ახლომახლო Bluetooth მოწყობილობებზე"</string> <string name="permlab_uwb_ranging" msgid="8141915781475770665">"შედარებითი პოზიციის დადგენა ახლომახლო ულტრაფართო სიხშირის მოწყობილობების შესახებ"</string> <string name="permdesc_uwb_ranging" msgid="2519723069604307055">"ნებას რთავს აპს, დაადგინოს შედარებითი პოზიცია ახლომახლო ულტრაფართო სიხშირის მოწყობილობების შესახებ"</string> diff --git a/core/res/res/values-lt/strings.xml b/core/res/res/values-lt/strings.xml index 88d005d5b06c..cf9552288545 100644 --- a/core/res/res/values-lt/strings.xml +++ b/core/res/res/values-lt/strings.xml @@ -539,9 +539,9 @@ <string name="permdesc_bluetooth" product="tablet" msgid="3053222571491402635">"Leidžiama programai peržiūrėti „Bluetooth“ konfigūraciją planšetiniame kompiuteryje ir užmegzti bei priimti ryšius iš susietų įrenginių."</string> <string name="permdesc_bluetooth" product="tv" msgid="8851534496561034998">"Programai leidžiama peržiūrėti „Bluetooth“ konfigūraciją „Android TV“ įrenginyje ir užmegzti bei priimti ryšius iš susietų įrenginių."</string> <string name="permdesc_bluetooth" product="default" msgid="2779606714091276746">"Leidžiama programai peržiūrėti „Bluetooth“ konfigūraciją telefone ir užmegzti bei priimti ryšius iš susietų įrenginių."</string> - <string name="permlab_bluetooth_scan" msgid="5402587142833124594">"„Bluetooth“ įr. netoliese aptikimas ir susiejimas"</string> + <string name="permlab_bluetooth_scan" msgid="5402587142833124594">"aptikti „Bluetooth“ įr. netoliese ir susieti"</string> <string name="permdesc_bluetooth_scan" product="default" msgid="6540723536925289276">"Leidžiama programai aptikti ir susieti „Bluetooth“ įrenginius netoliese"</string> - <string name="permlab_bluetooth_connect" msgid="6657463246355003528">"prisijungimas prie susietų „Bluetooth“ įrenginių"</string> + <string name="permlab_bluetooth_connect" msgid="6657463246355003528">"prisijungti prie susietų „Bluetooth“ įrenginių"</string> <string name="permdesc_bluetooth_connect" product="default" msgid="4546016548795544617">"Leidžiama programai prisijungti prie susietų „Bluetooth“ įrenginių"</string> <string name="permlab_bluetooth_advertise" msgid="2781147747928853177">"reklamuoti netoliese es. „Bluetooth“ įrenginiuose"</string> <string name="permdesc_bluetooth_advertise" product="default" msgid="6085174451034210183">"Programai leidžiama reklamuoti netoliese esančiuose „Bluetooth“ įrenginiuose"</string> diff --git a/core/res/res/values-nl/strings.xml b/core/res/res/values-nl/strings.xml index 31ae37214e9e..84b1a19672f4 100644 --- a/core/res/res/values-nl/strings.xml +++ b/core/res/res/values-nl/strings.xml @@ -537,8 +537,8 @@ <string name="permdesc_bluetooth_scan" product="default" msgid="6540723536925289276">"Hiermee kan de app bluetooth-apparaten in de buurt vinden en koppelen"</string> <string name="permlab_bluetooth_connect" msgid="6657463246355003528">"verbinding maken met gekoppelde bluetooth-apparaten"</string> <string name="permdesc_bluetooth_connect" product="default" msgid="4546016548795544617">"Hiermee kan de app verbinding maken met gekoppelde bluetooth-apparaten"</string> - <string name="permlab_bluetooth_advertise" msgid="2781147747928853177">"adverteren op bluetooth-apparaten in de buurt"</string> - <string name="permdesc_bluetooth_advertise" product="default" msgid="6085174451034210183">"Hiermee kan de app adverteren op bluetooth-apparaten in de buurt"</string> + <string name="permlab_bluetooth_advertise" msgid="2781147747928853177">"uitzenden naar bluetooth-apparaten in de buurt"</string> + <string name="permdesc_bluetooth_advertise" product="default" msgid="6085174451034210183">"Hiermee kan de app uitzenden naar bluetooth-apparaten in de buurt"</string> <string name="permlab_uwb_ranging" msgid="8141915781475770665">"relatieve positie tussen ultrabreedbandapparaten in de buurt bepalen"</string> <string name="permdesc_uwb_ranging" msgid="2519723069604307055">"De app toestaan om de relatieve positie tussen ultrabreedbandapparaten in de buurt te bepalen"</string> <string name="permlab_preferredPaymentInfo" msgid="5274423844767445054">"Informatie over voorkeursservice voor NFC-betaling"</string> diff --git a/core/res/res/values-ro/strings.xml b/core/res/res/values-ro/strings.xml index c1559dd8fd8a..c54ef9241df3 100644 --- a/core/res/res/values-ro/strings.xml +++ b/core/res/res/values-ro/strings.xml @@ -540,7 +540,7 @@ <string name="permdesc_bluetooth_scan" product="default" msgid="6540723536925289276">"Permite aplicației să descopere și să asocieze dispozitive Bluetooth din apropiere"</string> <string name="permlab_bluetooth_connect" msgid="6657463246355003528">"să se conecteze la dispozitive Bluetooth asociate"</string> <string name="permdesc_bluetooth_connect" product="default" msgid="4546016548795544617">"Permite aplicației să se conecteze la dispozitive Bluetooth asociate"</string> - <string name="permlab_bluetooth_advertise" msgid="2781147747928853177">"să difuzeze anunțuri pe dispozitive Bluetooth din apropiere"</string> + <string name="permlab_bluetooth_advertise" msgid="2781147747928853177">"să transmită anunțuri pe dispozitive Bluetooth din apropiere"</string> <string name="permdesc_bluetooth_advertise" product="default" msgid="6085174451034210183">"Permite aplicației să difuzeze anunțuri pe dispozitive Bluetooth din apropiere"</string> <string name="permlab_uwb_ranging" msgid="8141915781475770665">"să stabilească poziția relativă dintre dispozitivele Ultra-Wideband din apropiere"</string> <string name="permdesc_uwb_ranging" msgid="2519723069604307055">"Permiteți-i aplicației să stabilească poziția relativă dintre dispozitivele Ultra-Wideband din apropiere"</string> diff --git a/core/res/res/values-sw/strings.xml b/core/res/res/values-sw/strings.xml index fa3fcc5fcb99..951f9641238e 100644 --- a/core/res/res/values-sw/strings.xml +++ b/core/res/res/values-sw/strings.xml @@ -533,13 +533,13 @@ <string name="permdesc_bluetooth" product="tablet" msgid="3053222571491402635">"Huruhusu programu kuona usanidi wa Bluetooth kwenye kompyuta kibao, na kutuma na kukubali miunganisho kwa vifaa vilivyooanishwa."</string> <string name="permdesc_bluetooth" product="tv" msgid="8851534496561034998">"Huruhusu programu iangalie mipangilio iliyowekwa ya Bluetooth kwenye kifaa chako cha Android TV na kufanya na kukubali miunganisho na vifaa vilivyooanishwa."</string> <string name="permdesc_bluetooth" product="default" msgid="2779606714091276746">"Huruhusu programu kuona usanidi wa Bluetooth kwenye simu, na kutuma na kukubali miunganisho kwa vifaa vilivyooanishwa."</string> - <string name="permlab_bluetooth_scan" msgid="5402587142833124594">"kutambua na kuoanisha vifaa vyenye Bluetooth vilivyo karibu"</string> + <string name="permlab_bluetooth_scan" msgid="5402587142833124594">"tambua na oanishe vifaa vyenye Bluetooth vilivyo karibu"</string> <string name="permdesc_bluetooth_scan" product="default" msgid="6540723536925289276">"Huruhusu programu itambue na kuoanisha kwenye vifaa vyenye Bluetooth vilivyo karibu"</string> - <string name="permlab_bluetooth_connect" msgid="6657463246355003528">"kuunganisha kwenye vifaa vyenye Bluetooth vilivyooanishwa"</string> + <string name="permlab_bluetooth_connect" msgid="6657463246355003528">"unganisha kwenye vifaa vyenye Bluetooth vilivyooanishwa"</string> <string name="permdesc_bluetooth_connect" product="default" msgid="4546016548795544617">"Huruhusu programu iunganishe kwenye vifaa vyenye Bluetooth vilivyooanishwa"</string> - <string name="permlab_bluetooth_advertise" msgid="2781147747928853177">"kutangaza kwenye vifaa vyenye Bluetooth vilivyo karibu"</string> + <string name="permlab_bluetooth_advertise" msgid="2781147747928853177">"tangaza kwenye vifaa vyenye Bluetooth vilivyo karibu"</string> <string name="permdesc_bluetooth_advertise" product="default" msgid="6085174451034210183">"Huruhusu programu itangaze kwenye vifaa vyenye Bluetooth vilivyo karibu"</string> - <string name="permlab_uwb_ranging" msgid="8141915781475770665">"kubainisha nafasi kati ya vifaa vyenye Bendi Pana Zaidi vilivyo karibu"</string> + <string name="permlab_uwb_ranging" msgid="8141915781475770665">"bainisha nafasi kati ya vifaa vyenye Bendi Pana Zaidi vilivyo karibu"</string> <string name="permdesc_uwb_ranging" msgid="2519723069604307055">"Ruhusu programu ibainishe nafasi kati ya vifaa vyenye Bendi Pana Zaidi vilivyo karibu"</string> <string name="permlab_preferredPaymentInfo" msgid="5274423844767445054">"Maelezo ya Huduma Inayopendelewa ya Malipo ya NFC"</string> <string name="permdesc_preferredPaymentInfo" msgid="8583552469807294967">"Huruhusu programu kupata maelezo ya huduma inayopendelewa ya malipo ya nfc kama vile huduma zilizosajiliwa na njia."</string> diff --git a/packages/SettingsLib/res/values-ja/strings.xml b/packages/SettingsLib/res/values-ja/strings.xml index dd3b00b71889..78d330b08d3e 100644 --- a/packages/SettingsLib/res/values-ja/strings.xml +++ b/packages/SettingsLib/res/values-ja/strings.xml @@ -378,7 +378,7 @@ <string name="force_allow_on_external_summary" msgid="8525425782530728238">"マニフェストの値に関係なく、すべてのアプリを外部ストレージに書き込めるようになります"</string> <string name="force_resizable_activities" msgid="7143612144399959606">"アクティビティをサイズ変更可能にする"</string> <string name="force_resizable_activities_summary" msgid="2490382056981583062">"マニフェストの値に関係なく、マルチウィンドウですべてのアクティビティのサイズを変更できるようにします。"</string> - <string name="enable_freeform_support" msgid="7599125687603914253">"フリーフォーム ウィンドウの有効化"</string> + <string name="enable_freeform_support" msgid="7599125687603914253">"フリーフォーム ウィンドウを有効にする"</string> <string name="enable_freeform_support_summary" msgid="1822862728719276331">"試験運用機能のフリーフォーム ウィンドウのサポートを有効にします。"</string> <string name="local_backup_password_title" msgid="4631017948933578709">"PC バックアップ パスワード"</string> <string name="local_backup_password_summary_none" msgid="7646898032616361714">"デスクトップのフルバックアップは現在保護されていません"</string> diff --git a/services/core/java/com/android/server/wm/TaskDisplayArea.java b/services/core/java/com/android/server/wm/TaskDisplayArea.java index e0e287699299..db6d3ce69cc8 100644 --- a/services/core/java/com/android/server/wm/TaskDisplayArea.java +++ b/services/core/java/com/android/server/wm/TaskDisplayArea.java @@ -41,14 +41,13 @@ import static com.android.server.wm.DisplayContent.alwaysCreateRootTask; import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_ROOT_TASK; import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM; -import static java.lang.Integer.MIN_VALUE; - import android.annotation.ColorInt; import android.annotation.Nullable; import android.app.ActivityOptions; import android.app.WindowConfiguration; import android.content.pm.ActivityInfo; import android.content.res.Configuration; +import android.graphics.Color; import android.os.UserHandle; import android.util.IntArray; import android.util.Slog; @@ -83,9 +82,9 @@ final class TaskDisplayArea extends DisplayArea<WindowContainer> { DisplayContent mDisplayContent; /** - * A color layer that serves as a solid color background to certain animations. + * Keeps track of the last set color layer so that it can be reset during surface migrations. */ - private SurfaceControl mColorBackgroundLayer; + private @ColorInt int mBackgroundColor = 0; /** * This counter is used to make sure we don't prematurely clear the background color in the @@ -359,6 +358,14 @@ final class TaskDisplayArea extends DisplayArea<WindowContainer> { } @Override + void setInitialSurfaceControlProperties(SurfaceControl.Builder b) { + // We want an effect layer instead of the default container layer so that we can set a + // background color on it for task animations. + b.setEffectLayer(); + super.setInitialSurfaceControlProperties(b); + } + + @Override void addChild(WindowContainer child, int position) { if (child.asTaskDisplayArea() != null) { if (DEBUG_ROOT_TASK) { @@ -946,11 +953,6 @@ final class TaskDisplayArea extends DisplayArea<WindowContainer> { void onParentChanged(ConfigurationContainer newParent, ConfigurationContainer oldParent) { if (getParent() != null) { super.onParentChanged(newParent, oldParent, () -> { - mColorBackgroundLayer = makeChildSurface(null) - .setColorLayer() - .setName("colorBackgroundLayer") - .setCallsite("TaskDisplayArea.onParentChanged") - .build(); mSplitScreenDividerAnchor = makeChildSurface(null) .setName("splitScreenDividerAnchor") .setCallsite("TaskDisplayArea.onParentChanged") @@ -962,43 +964,35 @@ final class TaskDisplayArea extends DisplayArea<WindowContainer> { } else { super.onParentChanged(newParent, oldParent); mWmService.mTransactionFactory.get() - .remove(mColorBackgroundLayer) .remove(mSplitScreenDividerAnchor) .apply(); - mColorBackgroundLayer = null; mSplitScreenDividerAnchor = null; } } - void setBackgroundColor(@ColorInt int color) { - if (mColorBackgroundLayer == null) { - return; - } - - float r = ((color >> 16) & 0xff) / 255.0f; - float g = ((color >> 8) & 0xff) / 255.0f; - float b = ((color >> 0) & 0xff) / 255.0f; - float a = ((color >> 24) & 0xff) / 255.0f; - + void setBackgroundColor(@ColorInt int colorInt) { + mBackgroundColor = colorInt; + Color color = Color.valueOf(colorInt); mColorLayerCounter++; - getPendingTransaction().setLayer(mColorBackgroundLayer, MIN_VALUE) - .setColor(mColorBackgroundLayer, new float[]{r, g, b}) - .setAlpha(mColorBackgroundLayer, a) - .setWindowCrop(mColorBackgroundLayer, getSurfaceWidth(), getSurfaceHeight()) - .setPosition(mColorBackgroundLayer, 0, 0) - .show(mColorBackgroundLayer); - - scheduleAnimation(); + // Only apply the background color if the TDA is actually attached and has a valid surface + // to set the background color on. We still want to keep track of the background color state + // even if we are not showing it for when/if the TDA is reattached and gets a valid surface + if (mSurfaceControl != null) { + getPendingTransaction() + .setColor(mSurfaceControl, + new float[]{color.red(), color.green(), color.blue()}); + scheduleAnimation(); + } } void clearBackgroundColor() { mColorLayerCounter--; // Only clear the color layer if we have received the same amounts of clear as set - // requests. - if (mColorLayerCounter == 0) { - getPendingTransaction().hide(mColorBackgroundLayer); + // requests and TDA has a non null surface control (i.e. is attached) + if (mColorLayerCounter == 0 && mSurfaceControl != null) { + getPendingTransaction().unsetColor(mSurfaceControl); scheduleAnimation(); } } @@ -1006,12 +1000,12 @@ final class TaskDisplayArea extends DisplayArea<WindowContainer> { @Override void migrateToNewSurfaceControl(SurfaceControl.Transaction t) { super.migrateToNewSurfaceControl(t); - if (mColorBackgroundLayer == null) { - return; + + if (mColorLayerCounter > 0) { + setBackgroundColor(mBackgroundColor); } // As TaskDisplayArea is getting a new surface, reparent and reorder the child surfaces. - t.reparent(mColorBackgroundLayer, mSurfaceControl); t.reparent(mSplitScreenDividerAnchor, mSurfaceControl); reassignLayer(t); scheduleAnimation(); diff --git a/services/core/java/com/android/server/wm/WallpaperController.java b/services/core/java/com/android/server/wm/WallpaperController.java index 4b2aa0f76272..b61e711d75f5 100644 --- a/services/core/java/com/android/server/wm/WallpaperController.java +++ b/services/core/java/com/android/server/wm/WallpaperController.java @@ -202,8 +202,11 @@ class WallpaperController { "Win " + w + ": token animating, looking behind."); } mFindResults.setIsWallpaperTargetForLetterbox(w.hasWallpaperForLetterboxBackground()); - // Found a target! End search. - return true; + // While the keyguard is going away, both notification shade and a normal activity such + // as a launcher can satisfy criteria for a wallpaper target. In this case, we should + // chose the normal activity, otherwise wallpaper becomes invisible when a new animation + // starts before the keyguard going away animation finishes. + return w.mActivityRecord != null; } return false; }; diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyData.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyData.java index 26c442dc1f47..e18e0020407f 100644 --- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyData.java +++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyData.java @@ -23,6 +23,7 @@ import android.app.admin.DevicePolicyManager; import android.content.ComponentName; import android.os.FileUtils; import android.os.PersistableBundle; +import android.os.UserHandle; import android.util.ArrayMap; import android.util.ArraySet; import android.util.DebugUtils; @@ -83,7 +84,7 @@ class DevicePolicyData { private static final String ATTR_NEW_USER_DISCLAIMER = "new-user-disclaimer"; // Values of ATTR_NEW_USER_DISCLAIMER - static final String NEW_USER_DISCLAIMER_SHOWN = "shown"; + static final String NEW_USER_DISCLAIMER_ACKNOWLEDGED = "acked"; static final String NEW_USER_DISCLAIMER_NOT_NEEDED = "not_needed"; static final String NEW_USER_DISCLAIMER_NEEDED = "needed"; @@ -613,6 +614,28 @@ class DevicePolicyData { } } + boolean isNewUserDisclaimerAcknowledged() { + if (mNewUserDisclaimer == null) { + if (mUserId == UserHandle.USER_SYSTEM) { + return true; + } + Slogf.w(TAG, "isNewUserDisclaimerAcknowledged(%d): mNewUserDisclaimer is null", + mUserId); + return false; + } + switch (mNewUserDisclaimer) { + case NEW_USER_DISCLAIMER_ACKNOWLEDGED: + case NEW_USER_DISCLAIMER_NOT_NEEDED: + return true; + case NEW_USER_DISCLAIMER_NEEDED: + return false; + default: + Slogf.w(TAG, "isNewUserDisclaimerAcknowledged(%d): invalid value %d", mUserId, + mNewUserDisclaimer); + return false; + } + } + void dump(IndentingPrintWriter pw) { pw.println(); pw.println("Enabled Device Admins (User " + mUserId + ", provisioningState: " diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java index a46ae27ff8d9..b89d116f4fe4 100644 --- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java @@ -5894,6 +5894,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { * (1.1) The caller is the Device Owner * (1.2) The caller is another app in the same user as the device owner, AND * The caller is the delegated certificate installer. + * (1.3) The caller is a Profile Owner and the calling user is affiliated. * (2) The user has a profile owner, AND: * (2.1) The profile owner has been granted access to Device IDs and one of the following * holds: @@ -5919,12 +5920,14 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { * If the caller is from the work profile, then it must be the PO or the delegate, and * it must have the right permission to access device identifiers. */ - if (hasProfileOwner(caller.getUserId())) { + int callerUserId = caller.getUserId(); + if (hasProfileOwner(callerUserId)) { // Make sure that the caller is the profile owner or delegate. Preconditions.checkCallAuthorization(canInstallCertificates(caller)); - // Verify that the managed profile is on an organization-owned device and as such - // the profile owner can access Device IDs. - if (isProfileOwnerOfOrganizationOwnedDevice(caller.getUserId())) { + // Verify that the managed profile is on an organization-owned device (or is affiliated + // with the device owner user) and as such the profile owner can access Device IDs. + if (isProfileOwnerOfOrganizationOwnedDevice(callerUserId) + || isUserAffiliatedWithDevice(callerUserId)) { return; } throw new SecurityException( @@ -9305,10 +9308,11 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { return false; } - // Allow access to the device owner or delegate cert installer. + // Allow access to the device owner or delegate cert installer or profile owner of an + // affiliated user ComponentName deviceOwner = getDeviceOwnerComponent(true); if (deviceOwner != null && (deviceOwner.getPackageName().equals(packageName) - || isCallerDelegate(packageName, uid, DELEGATION_CERT_INSTALL))) { + || isCallerDelegate(packageName, uid, DELEGATION_CERT_INSTALL))) { return true; } final int userId = UserHandle.getUserId(uid); @@ -9318,7 +9322,8 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { final boolean isCallerProfileOwnerOrDelegate = profileOwner != null && (profileOwner.getPackageName().equals(packageName) || isCallerDelegate(packageName, uid, DELEGATION_CERT_INSTALL)); - if (isCallerProfileOwnerOrDelegate && isProfileOwnerOfOrganizationOwnedDevice(userId)) { + if (isCallerProfileOwnerOrDelegate && (isProfileOwnerOfOrganizationOwnedDevice(userId) + || isUserAffiliatedWithDevice(userId))) { return true; } @@ -10765,10 +10770,11 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { @Override public void acknowledgeNewUserDisclaimer() { CallerIdentity callerIdentity = getCallerIdentity(); - canManageUsers(callerIdentity); + Preconditions.checkCallAuthorization(canManageUsers(callerIdentity) + || hasCallingOrSelfPermission(permission.INTERACT_ACROSS_USERS)); setShowNewUserDisclaimer(callerIdentity.getUserId(), - DevicePolicyData.NEW_USER_DISCLAIMER_SHOWN); + DevicePolicyData.NEW_USER_DISCLAIMER_ACKNOWLEDGED); } private void setShowNewUserDisclaimer(@UserIdInt int userId, String value) { @@ -10801,6 +10807,18 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { } @Override + public boolean isNewUserDisclaimerAcknowledged() { + CallerIdentity callerIdentity = getCallerIdentity(); + Preconditions.checkCallAuthorization(canManageUsers(callerIdentity) + || hasCallingOrSelfPermission(permission.INTERACT_ACROSS_USERS)); + int userId = callerIdentity.getUserId(); + synchronized (getLockObject()) { + DevicePolicyData policyData = getUserData(userId); + return policyData.isNewUserDisclaimerAcknowledged(); + } + } + + @Override public boolean removeUser(ComponentName who, UserHandle userHandle) { Objects.requireNonNull(who, "ComponentName is null"); Objects.requireNonNull(userHandle, "UserHandle is null"); @@ -14589,7 +14607,13 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { final CallerIdentity caller = getCallerIdentity(); Preconditions.checkCallAuthorization(hasCrossUsersPermission(caller, userId)); - return isUserAffiliatedWithDeviceLocked(userId); + return isUserAffiliatedWithDevice(userId); + } + + private boolean isUserAffiliatedWithDevice(@UserIdInt int userId) { + synchronized (getLockObject()) { + return isUserAffiliatedWithDeviceLocked(userId); + } } private boolean isUserAffiliatedWithDeviceLocked(@UserIdInt int userId) { |