Skip to content
Commit b79a30ca authored by Mike McCreavy's avatar Mike McCreavy
Browse files

[cts][WoM] Fix CtsPermissionTestCases for Wear

b/288217526 tracks several CtsPermissionTestCase failures for
Wear on Main.

This CL is a proposal that focuses on fixing *just* the
"UndefinedGroupPermissionTest" tests for Wear.

Heads up: these Permission CTS tests aren't in the "cts" repo –
kvakil@ moved Permission CTS tests from platform/cts to
platform/packages/modules/Permission at the end of July 2023 in:

If8856b546a8d4a733e3ec0139798b4495e604054 (delete)
I1534d186dfeb3015819f17cecc40b9668e79b9f2 (add)

I wonder if that's the reason I can't see history of runs in:

https://android-build.corp.google.com/test_hub/search/?config=wear/wear_cts_on_cf

I can't find any "android.permission.cts" module run reports – I can find "android.permissionui.cts" though:

https://screenshot.googleplex.com/otMNQhRAAPjvH4P.png

Anyway, back when these tests were under platform/cts,
colefaust@ added some AUTOMOTIVE-specific behavior to the
original "platform/cts" tests in:

I1a667508e6fff8985b669019e33324c3b75acee9 (adds 'AUTOMOTIVE' tweak)

to get things working for AUTOMOTIVE.  I'm proposing a similar
change for WATCH because the runtime layout is different for
WATCH than it is normally: there is no "grant_dialog" element,
and the buttons are images instead of text.

Here's the UI structure I see on cf_gwear_x86 (screenshot: https://screenshot.googleplex.com/38AytTsg7qbEmmp.png):

- com.google.android.permissioncontroller ---
|APPLICATION size:100% 450x450  FrameLayout size:100%
|  (FrameLayout size:100%)
|    (FrameLayout @content size:100%)
|      ScrollView size:100%
|        (LinearLayout @content size:100%)
|          (FrameLayout size:24%)
|            (ImageView @icon size:1.1%)
|          TextView @title "Allow CtsPermissionUnknownGroup to record audio?" size:29%
|          (FrameLayout @buttonPanel size:42%)
|            (LinearLayout @buttonContainer size:39%)
|              [ImageButton @permission_deny_button //Cancel size:5%]
|              [ImageButton @permission_allow_button //Yes size:5%]

Compared with the UI structure I see on cf_x86_phone (screenshot: https://screenshot.googleplex.com/7UoBGzU5iuE4uEC.png):

- com.google.android.permissioncontroller ---
|Allow CtsPermissionUnknownGroup to record audio? APPLICATION size:60% 684x811  FrameLayout size:60%
|  (FrameLayout size:60%)
|    (FrameLayout @content size:60%)
|      ScrollView size:60%
|        [LinearLayout @grant_singleton size:60%]
|          [LinearLayout @grant_dialog size:60%]
|            (LinearLayout @content_container size:23%)
|              (LinearLayout size:14%)
|                (ImageView @permission_icon size:0.4%)
|                TextView @permission_message "Allow CtsPermissionUnknownGroup to record audio?" size:9%#heading
|            (LinearLayout size:27%)
|              [Button @permission_allow_foreground_only_button "While using the app" size:6%]
|              [Button @permission_allow_one_time_button "Only this time" size:6%]
|              [Button @permission_deny_button "Don’t allow" size:6%]

Note: on cf_gwear_x86, the allow and deny buttons *don't* have any visible text, but when this resource gets queried:

permissionControllerResources?.getString(
                        permissionControllerResources.getIdentifier(
                                "grant_dialog_button_deny", "string",
                                "com.android.permissioncontroller")

it comes back as "Don't allow" (which is the text that's displayed on a phone).

I don't grok how overlays and modules work, I see:

~/main/packages/modules/Permission/PermissionController/res/values/overlayable.xml

but I don't know how Wear changed the activity's UI.

Anyway, to get these tests working on Wear, I propose a "look for the
allow button" special case for WATCH.

Happy to change this to something else that doesn't special-case WATCH
(like look for "Allow CtsPermissionUnknownGroup to record audio?" text)
if the Permissions team has best practices to recommend!  Thanks for
your recommendations, as I am an Android, CTS, and Permission newbie!

Bug: b/288217526
Test: atest android.permission.cts.UndefinedGroupPermissionTest
Change-Id: I16c99f655487708bfd2dc44610760cc8c237264b
parent efdb1503
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment