summaryrefslogtreecommitdiff
path: root/WifiDialog/src
AgeCommit message (Collapse)Author
2024-11-14Update P2P dialog Quang Anh Luong
Update P2P dialog strings to be more user friendly and show the peer device name in the dialog message instead of a separate line. Flag: com.android.wifi.flags.p2p_dialog2 Bug: 349253691 Test: Manual verification via shell cmd that P2P dialog styles are correct Change-Id: Iaa719420deed4472be4b4b8060ec987a9cd9092f
2024-10-25Add overlay to control showing P2P invitation timeout Quang Anh Luong
Updated-Overlayable: TRUE Flag: EXEMPT gated by overlay Bug: 349253691 Test: manually verify dialog doesn't show timeout when overlay value is false Change-Id: I94a88ccd43c808da0a9cb020b25f03d13ac81d04
2024-10-25Remove timeout from all dialogs except P2P invitation received Quang Anh Luong
Dialog timeout is generalized to all dialogs, but is only usedfor the P2P invitation received dialog. Refactor the timeout logic out of all the non-P2P-invitation-received dialogs to clean up the code and make it easier for special P2P timeout logic (e.g. changing the message text to show remaining time). Flag: EXEMPT non-functional refactor Bug: 349253691 Test: atest FrameworksWifiTests, manual test with shell command to see if P2P dialog still shows correctly with timeout. Change-Id: Id4a6f41073bfc4501c6e33840a40f812f84a163d
2024-01-11Merge "Dismiss dialogs in onStop()" into udc-mainline-prod am: 0341a69cc9 Quang Luong
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Wifi/+/25846274 Change-Id: If6023615f281f3d7ea1f12ab2fc181f2f748fd3d Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-01-10Dismiss dialogs in onStop() Quang Anh Luong
Dismiss WifiDialog dialogs in onStop() to prevent ANRs when the activity is frozen but the dialog is still being shown with the screen off. Bug: 317837996 Test: `adb shell cmd wifi launch-dialog-simple -t` while screen is off, verify dialog appears when screen turns on. Change-Id: I8f55d4c81a4f0ab28d17865feceb370ec8e3a83d
2023-10-30Close dialogs on power button press Quang Anh Luong
Checking for screen off when we get ACTION_CLOSE_SYSTEM_DIALOGS isn't reliable for differentiating whether the action came from the home button or the power button. For simplicity and consistency, close on all ACTION_CLOSE_SYSTEM_DIALOGS including the power button press. Also add an extra check for EXTRA_CLOSE_SYSTEM_DIALOGS_EXCEPT_WIFI, which was erroneously removed previously. Bug: 297981585 Test: atest WifiDialogManagerTest, manually verify "adb shell cmd wifi launch-dialog-simple -t Title" and then pressing power button will close the dialog. Change-Id: Ibc6fdaed570760ecaf12d453fe9d40219fc30adc
2023-09-21Fix NPE in WifiDialogActivity Ye Jiao
WifiDialogActivity uses `get(int key)` to iterate all values in SparseArray `mActiveDialogsPerId` and causes NPE. Use `valueAt(int index)` instead of `get(int key)`. Bug: 30126387 Test: MTBF Auto Test Test: Add temporary log messages and bring up the Wifi Direct invitation dialog. Close the dialog by bringing up the home menu. Verify the logs. Change-Id: I6f4bc5766700307a4271282e09825ae4db76b78f
2023-07-27Fix P2P PIN accept button greyed out incorrectly on config change Quang Anh Luong
The P2P PIN accept button in the P2P invitation dialog should be greyed out if the PIN is not 4 or 8 digits in length. However, if the correct number of digits is inputted and then a configuration change reloads the dialog (e.g. light -> dark mode), then the accept button is still greyed out upon reload. Add an extra check when reloading the dialog to enable the button if the pre-existing input is the correct length. Bug: 292441663 Test: manually verify using adb shell cmd wifi launch-dialog-p2p-invitation-received Device -p -c 0, input 4 digits to PIN entry, change device from light->dark mode, verify Accept button is not greyed out upon reloading the dialog. Change-Id: Ia90f7dd23316cc0d04a5326dbd27e771ef77af1d
2023-07-13Fix P2P dialog time remaining text being cut off Quang Anh Luong
P2P dialog time remaining text is set as a message in the AlertDialog, separately from the ScrollView containing the rest of the P2P dialog text. If the screen size is too small to fit the dialog and the keyboard, the dialog will get squished and push the message underneath the Title, cutting it off. To prevent this, move the time remaining text to the ScrollView with the rest of the P2P text so the text is more compact and is able to be scrolled together if the dialog is too small. Updated-Overlayable: Not applicable - changing default value Bug: 288179496 Test: manually verify timeleft text appears in rest of the ScrollView using adb shell cmd wifi launch-p2p-dialog-invitation-received DeviceName -c 15000 -p Change-Id: Ic2cf4dd0cbf5e33ff38023e89b3e1388cf4d1fdb
2023-04-04Merge "Fix WifiDialog app showing a solid background on U-on-T" into udc-dev Quang Luong
2023-04-02Fix WifiDialog app showing a solid background on U-on-T Quang Luong
Fix WifiDialog app showing a solid background on U-on-T with the following changes: 1) Manually declare a transparent theme for WifiDialog. 2) Don't override getResources() with ServiceWifiResources and instead reference ServiceWifiResources directly when needed. 3) Use public device default dialog themes instead of the private Theme.DeviceDefault.Dialog.Alert.DayNight. 4) Manually set the textColor of the P2P PIN input since it's not visible anymore with new style settings. Bug: 238353074 Test: manually verify dialog looks correct using `adb shell cmd wifi launch-dialog-simple` and `adb shell cmd wifi launch-dialog-p2p-invitation-received` on U-on-T. Updated-Overlayable: Not applicable - changing default value Change-Id: If47ba975ffc8706e6457b7ed6fc4f7e3bb23986b
2023-03-30Focus "Invitation to connect" dialog on "Decline" Antonino Faraone
When no pin input is required, focus on the Decline button Bug: 245461684 Test: Manual Change-Id: I1bf379c1ad4bc1cc5af1406a092d41919e18e3a6
2023-03-29Fix permission issue of WifiDialog Antonino Faraone
Add INTERNAL_SYSTEM_WINDOW manifest permission to fix "permission denied for window type 2008" error Bug: 275486387 Test: Manual Change-Id: I495f04b047bd267bcc923e2e1e36124c0a97db45
2023-03-22Keep WifiDialogs up even when screen is off Quang Luong
Do not cancel dialogs in onStop() anymore, which allows dialogs to show even when the screen is off and the Activity is stopped. Cancelling in onStop() was needed because other apps might cover up active dialogs without the user knowing, but using TYPE_SYSTEM_DIALOG now shows dialogs over all apps and this behavior isn't needed anymore. Bug: 239474988 Test: adb shell cmd wifi launch-dialog-simple -t Title -m Message, manually verify dialogs stay up when screen is off, and remain on top if Settings is opened while a dialog is up. Change-Id: I10dbcdbfc31990e36a63e4c994e39a723ed0aaa6
2022-12-09Merge "Cancel dialog on onStop() even if screen off" into tm-mainline-prod Quang Luong
2022-12-07Merge "Clean up WifiDialogActivity's home button logic" into tm-mainline-prod Quang Luong
2022-12-06Merge "Kill WifiDialog process from Wifi service" into tm-mainline-prod Quang Luong
2022-12-05Cancel dialog on onStop() even if screen off Quang Luong
Dialogs will now be canceled on onStop() even if the screen is off (either through timeout or power button press). Bug: 260385660 Test: adb shell cmd wifi launch-dialog-simple -t Title -m Message, verify dialog is canceled if screen turns off or is already off. Change-Id: I899a23faf08507c01baa834ee5a3f8e99e3bbcd3
2022-12-05Clean up WifiDialogActivity's home button logic Quang Luong
WifiDialogActivity cancels all dialogs when ACTION_CLOSE_SYSTEM_DIALOGS is received. However, this happens before the device transitions to the home screen, allowing apps to immediately request a new dialog right before they're put into the background. This results in a dialog popping over the home screen. Instead, we should cancel the dialogs in onStop() (if not a configuration change or screen off), which happens after the user navigates to the home screen and the rest of the activities are put to the background. Bug: 257398441 Test: enable ICM dialogs and use test app to constantly request an iface dialog, verify home button press closes the dialog and does not pop a dialog over the home screen. Change-Id: I25ff807307d2d1c4d609df9d316f91e3f1407dbc
2022-12-05Kill WifiDialog process from Wifi service Quang Luong
Have Wifi service send signal to kill the WifiDialog process instead of handling it implicitly from WifiDialogActivity. This allows for future synchronization to avoid launching a dialog at the same time the process is being killed, which causes undefined race-condition behavior. Bug: 257398441 Test: adb shell cmd wifi launch-dialog-simple -t Title -m Message, verify process is killed in logcat when dialog is replied/cancelled/home button pressed. Change-Id: Ia08a8226867d0171fd3b72f35e0c11802a920851
2022-11-30Make dialog handles @NonNull Quang Luong
WifiDialogManager may return null dialog handles if some of the arguments are illegal. However, if these null handles are uncaught then this may cause an NPE on the wifi thread. Thus it is better to simply log the illegal argument and display the dialog without the illegal arguments anyway. Bug: 260544149 Test: atest WifiDialogManagerTest, manually verify dialogs via adb shell cmd wifi launch-dialog* commands Change-Id: I7ae43d4b758e35748311b093e904432c2d3a429c
2022-11-03Make wifi dialog style overlayable Quang Luong
Add an overlayable style for all wifi dialogs (excluding P2P invitation received, which has the style wifi_p2p_invitation_received_dialog. Updated-Overlayable: TRUE Bug: 256685780 Test: atest WifiDialogManagerTest, update default value of wifi_dialog and verify the changes appear via adb shell cmd wifi launch-dialog-simple -t Title -m Message Change-Id: Ia928e64ad1c9733393cb76b80c53c80bf2b4b829
2022-10-07Do not auto-open keyboard on P2P pin in landscape Quang Luong
The P2P invitation dialog auto-opens the keyboard on the pin input, but landscape mode on phones is not big enough to display both the P2P dialog and the keyboard at same time. Thus we shouldn't auto-open the keyboard in landscape mode for less-than-large sized screens (tablets), and instead have the user manually tap on the pin field to use the full-screen landscape mode keyboard. Bug: 248187548 Test: adb shell cmd wifi launch-dialog-p2p-invitation-received DeviceName -p, manually verify keyboard does not auto-open in landscape mode Change-Id: I5f20db226061e34205a146e4af238356e340d334
2022-10-04Fix P2P invitation dialog transparency Quang Luong
Fix issue with P2P invitation dialog showing as full screen + transparent by using ContextThemeWrapper to pass the custom P2P invitation style to the AlertDialog.Builder instead of passing the style id directly. Bug: 250086729 Test: adb shell cmd wifi launch-dialog-p2p-invitation-received DeviceName -p, verify dialog shows correctly Change-Id: Iec5246637c737ceefeecfdd5e4686777163e770e
2022-09-12Add countdown message to P2P Invitation Received dialog Quang Luong
Add a countdown message "Accept in XX seconds." to the P2P Invitation Received dialog if a timeout is specified. Updated-Overlayable: TRUE Bug: 242681450 Test: adb shell cmd wifi launch-dialog-p2p-invitation-received with timeout, verify countdown message appears. Change-Id: Ia16d5191f53ba50506985023787701817364c43f
2022-09-12Handle timeout directly in WifiDialogActivity Quang Luong
Pass the dialog timeout to WifiDialogActivity directly instead of handling the timeout in WifiDialogManager. This is a non-functional change that will allow further timeout-based UI in the dialogs, such as a countdown timer. Bug: 242681450 Test: atest WifiDialogManagerTest, adb shell cmd wifi launch-dialog-simple with timeout, verify dialog is cancelled after timeout. Change-Id: I6e76c413854b8cbf5922d3f54ede2b97c4ee6ffa
2022-09-02Close QuickSettings when creating WifiDialog app dialog Quang Luong
Dialogs created by the WifiDialog app cannot display over QuickSettings, so send an ACTION_CLOSE_SYSTEM_DIALOGS broadcast to close the QuickSettings before showing the dialog. Bug: 239364438 Test: atest WifiDialogManagerTest, manually verify dialog closes QuickSettings via adb shell cmd wifi launch-dialog-simple Change-Id: I4eccd6d2bbe6de332f5e8b7d822e5951f584cd3b
2022-08-26Add overlay to control Wifi dialog canceled on touch outside Quang Luong
Add overlay config_wifiDialogCanceledOnTouchOutside to control whether or not to cancel wifi dialogs when the screen is touched outside the dialog. Default to false to retain legacy behavior of not cancelling. Updated-Overlayable: TRUE Bug: 236799857 Test: atest WifiDialogManagerTest, set config value to false and manually verify dialog is canceled on touch outside. Change-Id: Ia8f16556af0288fc43d49bc0541cb648311c25fc
2022-07-15Do not cancel dialogs in onStop() due to screen off Quang Luong
Dialogs are cancelled in onStop() if it's not a configuration change in case another application pushes it to the background. If onStop() is called due to the screen turning off, we should not cancel the dialogs. Bug: 237482092 Test: adb shell cmd wifi launch-dialog-simple -t Title -m Message -y Yes -n No -c 0, turn screen off and on and verify dialog is still there, open Settings from QS and verify dialog is cancelled. Change-Id: Ie8c65459a30d1b4e7c8aeba4ff2136009723f102
2022-07-15Do not kill WifiDialog process if there are activities remaining Quang Luong
There may be edge cases where WifiDialogActivity finishes and a new dialog is requested immediately. In this case, the new dialog request starts a new WifiDialogActivity since the first one is finishing. However, once the first activity calls onDestroy(), we end up killing the entire Process which kills the second activity. Instead, we should check if there are any other activity instances before calling killing the process. Bug: 236803960 Test: Enable iface conflict dialog, turn on STA + AP, go to P2P settings and reject the dialog. Verify the second dialog pops up immediately and the process is not killed. Verify accepting the second dialog kills the process. Change-Id: I19ffebdc1b7285b67dd0b4ca825dd27fac945e2b
2022-07-06Auto-open keyboard for P2P PIN input Quang Luong
Automatically open the keyboard when a P2P PIN input dialog appears. Bug: 237032182 Test: adb shell cmd wifi launch-dialog-p2p-invitation-received DeviceName -p, verify keyboard opens automatically Change-Id: Ie2672c35eaf1094a803be8dec5b6c7a5d74d0431
2022-07-06Cancel all dialogs in onStop() if not a configuration change Quang Luong
When the configuration changes, we do not cancel any dialogs so that we can recreate them when the Activity is restarted. However, if onStop() is called without a configuration change (different Activity coming to the foreground), then we should cancel all dialogs. Bug: 237482092 Test: Launch dialog with `adb shell cmd wifi launch-dialog-simple -t Title -m Message -c 0`, then run `adb shell am start -n com.google.android.setupwizard/.SetupWizardTestActivity` to launch SetupWizard, and verify the dialog was cancelled. Verify launching dialog and toggling dark mode does not cancel the dialog. Change-Id: I1eff91d5d81098ddaa00fe3712987eadc808e00d
2022-06-07Add P2P dialog PIN length validation Quang Luong
Add validation to P2P dialog PIN length, disabling the positive button unless the PIN length is 4 or 8. Bug: 234326049 Test: adb shell cmd wifi launch-dialog-p2p-invitation-received name -p, verify positive button only appears if the input length is 4 or 8. Change-Id: I0f8b01305c0b4b54e57dd6fcd8b5d6cbca2433b2
2022-05-16Do not set URL span if span start/end are invalid Quang Luong
The URL span for a wifi dialog's message is set with 0 start/end index if there is no URL needed. However, this causes an exception if the text is modified by an accessibility mode (b/169417148). Thus we should avoid setting the URL span at all if it isn't needed to avoid this bug. Bug: 232272207 Test: Turn Settings->Accessibility->TalkBack on, launch dialog with `adb shell cmd wifi launch-dialog-simple -m message` and verify it doesn't crash. Change-Id: Ia6cfc94128df3f2a850edea03c2484c9bf179141
2022-04-28Check for null before setting link movement method for message view Quang Luong
WifiDialogActivity sets the movement method for the dialog message view in order to make URLs clickable. However, the method to get the View object may return null if the message View is not present. Thus we should add a null check for this View. Bug: 230072855 Test: adb shell cmd wifi launch-dialog-simple -m link -l https://www.google.com 0 4 Change-Id: Ib382128117f20fff2c5da76098e295a2824e45ce
2022-04-20Allow customization of P2P Invitation Received dialog style Quang Luong
Add an overlayable style item to ServiceWifiResources to allow the style of the P2P Invitation Received dialog to be customized. Bug: 208386468 Test: modify style, build, and observe P2P invitation received dialog style changes through adb shell cmd wifi launch-dialog-p2p-invitation-received Change-Id: I2252d771611e9f3b1207c2940f1def9e8fbf1ae8
2022-03-10Launch the activity on the correct display Etan Cohen
Launch the activity on the correct display as opposed to trying to launch the dialog on the display. Using shell commands to display dialog to specific display: Start with fake command to get a list of displays: % adb shell cmd wifi launch-dialog-p2p-invitation-received AAAA -i 10 Then select a display and run command again: % adb shell cmd wifi launch-dialog-p2p-invitation-received AAAA -i <ID> Bug: 199829817 Test: manual using adb shell commands Test: atest WifiDialogManagerTest Change-Id: Iaf8746d9bf1d9eb7b47748dc72746bc2828a0bda
2022-03-02Use WifiDialogManager for P2P Invitation Sent dialog Quang Luong
Replace usage of FrameworkFacade.makeAlertDialogBuilder(...) with the new WifiDialogManager for the P2P Invitation Sent dialog. Bug: 209032090 Test: atest WifiP2pServiceImplTest, manually verify dialog is shown for CtsVerifier->Wi-Fi Direct Test->Group Client Test ->Join p2p group test (PIN) Change-Id: I3e4b89d26c89037059614e4ba97b13a73f123d69
2022-02-24Allow URLs in simple dialog messages. Quang Luong
Add WifiDialogManager.createSimpleDialogWithUrl(...) to allow specifying a URL in the message text between specified indices. Bug: 209032090 Test: adb shell cmd wifi launch-dialog-simple -m "Go\ to\ Google" -l "https://www.google.com" 0 12, tap on link and verify it goes to www.google.com Change-Id: I4ffc0f3b755d32ffda1575741f95b6cc826b51f8
2022-02-18Refactor WifiDialogManager to allow clients to dismiss dialogs Quang Luong
Return a thread-safe DialogHandle to clients when they request a dialog. DialogHandle acts as a reference to the requested dialog, which clients can use to launch the dialog as well as dismiss the dialog without waiting for user action if they don't need it anymore. Bug: 209032090 Test: atest FrameworksWifiTests Change-Id: I660710a58695ac8775d51e959b569c0c921588b8
2022-02-18Implement generic simple dialog in WifiDialog APK Quang Luong
Implement a generic simple dialog in WifiDialog APK that optionally contains a title, message, and positive/negative/neutral buttons. This type of dialog adheres to the standard DialogInterface, and will be the most commonly used dialog. Dialogs with custom UI not described by DialogInterface will need their own bespoke dialog types (e.g. P2pInvitationReceivedDialog). Bug: 206676522 Test: atest FrameworksWifiTests Change-Id: I9278f4a32e38f29531a57c60aa67d9ba6fcabab8
2022-02-11Add notification sound/vibration for P2P Invitation Received Dialog Quang Luong
Add a notification sound (or vibration, if the device ringer mode is VIBRATE) when a P2P invitation is received. Bug: 201381041 Test: CtsVerifier Wi-Fi Direct test to trigger P2P Invitation Received Dialog and verify that device will sound off, vibrate, and be silent for ringer modes NORMAL, VIBRATE, and SILENT respectively. Change-Id: I894cbc58cd1c3b49a4565b3fd507f1081c656d05
2022-02-03Pipe display information from privileged context Etan Cohen
Pipe display identifier information (from privileged context). Store in the client identifier. Extract to be used in determining the display on which to display the dialog. Bug: 199829817 Test: atest android.net.wifi Test: atest com.android.server.wifi Change-Id: I7fa7ee95c5c629e8bee7d4008d3c04a659c62d0f
2022-02-01Add timeout to P2P invitation received dialog Quang Luong
Implement a timeout for P2P invitation received dialog by creating a Intent action to cancel a specific dialogId, and posting a delayed runnable to cancel the dialog after the timeout. Bug: 203017876 Test: set the timeout overlay to 5000, verify adb shell cmd wifi launch-dialog-p2p-invitation-received <ssid> is cancelled after 5000 ms, atest WifiDialogManagerTest Change-Id: I9871bf4f4435769b06b1d4a03843a13fa94b4eb2
2022-01-28Add Gravity overlay for wifi dialogs Quang Luong
Add an overlayable value to indicate the Gravity of all wifi dialogs. Bug: 201723053 Test: modify overlay value and adb shell cmd wifi launch-dialog-p2p-invitation-received <ssid> and verify dialog gravity changes. Change-Id: I3a6407c96a89d229d0d2c4a79a09f3ebacf527c7
2022-01-26Plumb reply to P2P Invitation Received dialog back to framework Quang Luong
Plumb the reply to the P2P Invitation Recieved dialog back to the framework via @hide APIs. Bug: 209032090 Test: atest WifiDialogManagerTest, Tap on dialog from `adb shell cmd launch-dialog-p2p-invitation-received <ssid>` and verify WifiDialogManager log for dialog response. Change-Id: Id0792073fee71a0829f2178f47570de85d891a01
2022-01-21Implement P2P Invitation Received dialog in WifiDialogActivity Quang Luong
Create a WifiDialogActivity to host dialogs in the WifiDialog app, and implement the P2P Invitation Received dialog. Create a WifiDialogManager class to manage launching dialogs and receiving replies in the framework. This CL does not route the dialog reply back to the framework -- that will be done in a future CL. Bug: 209032090 Test: verify `adb shell cmd wifi launch-dialog-p2p-invitation-received` brings up a dialog. Change-Id: I60e6d9d8e71b38d3604dfaeba0a1bcbddf9a3c2c