SystemUI: Show daily data usage in QS footer

Author: Adithya <gh0strider.2k18.reborn@gmail.com>
Date:   Fri Sep 10 14:20:54 2021 +0530

    SystemUI: Show daily data usage in QS footer

     * Refactor existing build text view
     * Adapt to T

    Squashed:

     * SettingsLib: Add method to get daily data usage
     * SystemUI: Show wifi usage in QS footer when available
     * SystemUI: Move QS page indicator to the right

    Change-Id: Ifcd39167e6522935a8a29dc89d7e5f415893d266
    Signed-off-by: Adithya R <gh0strider.2k18.reborn@gmail.com>

Author: Adithya R <gh0strider.2k18.reborn@gmail.com>
Date:   Thu Sep 29 00:49:35 2022 +0530

    SystemUI: Hide QS data usage if no wifi/sims

    Instead of showing dummy text like '0 B used today'.

    Change-Id: I066751ad7f791e2efcaab43a20b6228f144d0c0d

Author: Adithya R <gh0strider.2k18.reborn@gmail.com>
Date:   Tue Oct 11 01:00:28 2022 +0530

    SystemUI: Avoid NPE in QS footer data usage

    In some rare cases, can hit this NPE.

    10-09 12:32:52.244  2316  2316 E AndroidRuntime: FATAL EXCEPTION: main
    10-09 12:32:52.244  2316  2316 E AndroidRuntime: Process: com.android.systemui, PID: 2316
    10-09 12:32:52.244  2316  2316 E AndroidRuntime: java.lang.NullPointerException: Attempt to get length of null array
    10-09 12:32:52.244  2316  2316 E AndroidRuntime:        at java.util.Set.of(Set.java:692)
    10-09 12:32:52.244  2316  2316 E AndroidRuntime:        at com.android.settingslib.net.DataUsageUtils.getNormalizedMobileTemplate(DataUsageUtils.java:67)
    10-09 12:32:52.244  2316  2316 E AndroidRuntime:        at com.android.settingslib.net.DataUsageUtils.getMobileTemplate(DataUsageUtils.java:57)
    10-09 12:32:52.244  2316  2316 E AndroidRuntime:        at com.android.settingslib.net.DataUsageController.getDailyDataUsageInfo(DataUsageController.java:109)
    10-09 12:32:52.244  2316  2316 E AndroidRuntime:        at com.android.systemui.qs.QSFooterView.setUsageText(QSFooterView.java:117)
    10-09 12:32:52.244  2316  2316 E AndroidRuntime:        at com.android.systemui.qs.QSFooterView.setNoSims(QSFooterView.java:184)
    10-09 12:32:52.244  2316  2316 E AndroidRuntime:        at com.android.systemui.qs.QSFooterViewController$2.setNoSims(QSFooterViewController.java:73)
    10-09 12:32:52.244  2316  2316 E AndroidRuntime:        at com.android.systemui.statusbar.connectivity.CallbackHandler.handleMessage(CallbackHandler.java:84)
    10-09 12:32:52.244  2316  2316 E AndroidRuntime:        at android.os.Handler.dispatchMessage(Handler.java:106)
    10-09 12:32:52.244  2316  2316 E AndroidRuntime:        at android.os.Looper.loopOnce(Looper.java:201)
    10-09 12:32:52.244  2316  2316 E AndroidRuntime:        at android.os.Looper.loop(Looper.java:288)
    10-09 12:32:52.244  2316  2316 E AndroidRuntime:        at android.app.ActivityThread.main(ActivityThread.java:7898)
    10-09 12:32:52.244  2316  2316 E AndroidRuntime:        at java.lang.reflect.Method.invoke(Native Method)
    10-09 12:32:52.244  2316  2316 E AndroidRuntime:        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
    10-09 12:32:52.244  2316  2316 E AndroidRuntime:        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)

    Change-Id: Ib5ab5da259a80b7f1e3a12b0c8a5078eb976fd20

Co-authored-by: AnkitGourav <Ankitgourav035@gmail.com>
Co-authored-by: Anushek Prasal <anushekprasal@gmail.com>
Co-authored-by: Jyotiraditya Panda <jyotiraditya@aospa.co>
Change-Id: I316b2a2cbdd69307cacd444bb6100c5c7dc56af4
5 files changed