• Calder Kitagawa's avatar
    [WebAPKs] Privacy disclosure Snackbar · c5bf413b
    Calder Kitagawa authored
    Adds a Snackbar to disclose when an unbound WebAPK or TWA is running in
    Chrome. This is designed such that users see the disclosure under the
    following conditions:
    
    - The webapp is a TWA or WebAPK
    - If it is a WebAPK it was not installed from Chrome.
    
    Until the user presses "OK, got it" the snackbar will persist and
    remains during navigation. If a session is ended without pressing
    "OK, got it" then the message will appear the next time the app is
    opened or resumed.
    
    This appears once per app installation with the caveat that if a user
    clears their Chrome data the app will show this message again.
    
    This change is implemented to only start showing the disclosure when
    the storage is null. This happens only when an app is opened for the
    first time. As such all deployed and launched unbound WebAPKs will not
    see this message. To facilitate this we set a boolean flag to show the
    message when we launch with null storage. The reason this is necessary
    that the default value for a key is false so for existing
    unbound WebAPKs we would try to show the message regardless of state
    if we didn't use a set, check, clear approach.
    
    Known issues:
    It appears that there is a finch trial for chrome modern that isn't
    properly initialized if the WebAPK is launched cold (i.e. Chrome
    hasn't been started) and Chrome's data has been wiped. As a result,
    the old black snackbar is shown instead of the white one. This is
    remedied if the app is relaunched and won't occur if Chrome is launched
    before the WebAPK.
    
    Bug: 862401
    Change-Id: Ieb09b7b628d5718908f8841b06b469c54ed59472
    Reviewed-on: https://chromium-review.googlesource.com/1142224
    Commit-Queue: Calder Kitagawa <ckitagawa@chromium.org>
    Reviewed-by: default avatarPeter Conn <peconn@chromium.org>
    Reviewed-by: default avatarTheresa <twellington@chromium.org>
    Reviewed-by: default avatarDominick Ng <dominickn@chromium.org>
    Reviewed-by: default avatarXi Han <hanxi@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#582187}
    c5bf413b
java_sources.gni 184 KB