Skip to content

Commit

Permalink
chore: address miscellaneous errorprone warnings
Browse files Browse the repository at this point in the history
> Task :compileDebugJavaWithJavac
• 1 src/com/github/iusmac/sevensim/scheduler/DaysOfWeek.java:116: warning: [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
     * @param dayOfWeek Any of {@link DayOfWeek} values.
       ^
    (see https://google.github.io/styleguide/javaguide.html#s7.2-summary-fragment)
  Did you mean '*Returns {@code true} if the given day of the week is on, {@code false} otherwise.'?

• 2 src/com/github/iusmac/sevensim/scheduler/DaysOfWeek.java:125: warning: [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
     * @return The weekly repeat schedule encoded as an integer.
       ^
    (see https://google.github.io/styleguide/javaguide.html#s7.2-summary-fragment)
  Did you mean '*Returns the weekly repeat schedule encoded as an integer.'?

• 3 src/com/github/iusmac/sevensim/scheduler/DaysOfWeek.java:130: warning: [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
     * @return {@code true} if at least one day of the week is enabled in the weekly repeat
       ^
    (see https://google.github.io/styleguide/javaguide.html#s7.2-summary-fragment)
  Did you mean '*Returns {@code true} if at least one day of the week is enabled in the weekly repeat'?

• 4 src/com/github/iusmac/sevensim/scheduler/DaysOfWeek.java:136: warning: [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
     * @return {@code true} if all days of the week are enabled in this weekly repeat schedule,
       ^
    (see https://google.github.io/styleguide/javaguide.html#s7.2-summary-fragment)
  Did you mean '*Returns {@code true} if all days of the week are enabled in this weekly repeat schedule,'?

• 5 src/com/github/iusmac/sevensim/scheduler/DaysOfWeek.java:142: warning: [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
     * @return The total number of days of the week enabled in this weekly repeat schedule.
       ^
    (see https://google.github.io/styleguide/javaguide.html#s7.2-summary-fragment)
  Did you mean '*Returns the total number of days of the week enabled in this weekly repeat schedule.'?

• 6 src/com/github/iusmac/sevensim/scheduler/DaysOfWeek.java:239: warning: [InvalidParam] Parameter name `useLongNames` is unknown. Did you mean useLongName?
     * @param useLongNames If {@code true}, the un-abbreviated day of the week names are used, e.g.
       ^
    (see https://errorprone.info/bugpattern/InvalidParam)
  Did you mean '* @param useLongName If {@code true}, the un-abbreviated day of the week names are used, e.g.'?

• 7 src/com/github/iusmac/sevensim/scheduler/DaysOfWeek.java:322: warning: [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
     * @param ldt The date-time to get the corresponding {@link DayOfWeek} value from.
       ^
    (see https://google.github.io/styleguide/javaguide.html#s7.2-summary-fragment)
  Did you mean '*Returns a {@link DayOfWeek} value.'?

• 8 src/com/github/iusmac/sevensim/telephony/Subscription.java:143: warning: [ReferenceEquality] Comparison using reference equality instead of value equality
            && mKeepDisabledAcrossBoots == subToCompare.mKeepDisabledAcrossBoots;
                                        ^
    (see https://errorprone.info/bugpattern/ReferenceEquality)
  Did you mean '&& Objects.equals(mKeepDisabledAcrossBoots, subToCompare.mKeepDisabledAcrossBoots);' or '&& mKeepDisabledAcrossBoots.equals(subToCompare.mKeepDisabledAcrossBoots);'?

• 9 src/com/github/iusmac/sevensim/telephony/Subscription.java:198: warning: [EmptyCatch] Caught exceptions should not be ignored
            } catch (DateTimeParseException ignored) {}
              ^
    (see https://google.github.io/styleguide/javaguide.html#s6.2-caught-exceptions)

• 10 src/com/github/iusmac/sevensim/telephony/Subscription.java:205: warning: [EmptyCatch] Caught exceptions should not be ignored
            } catch (DateTimeParseException ignored) {}
              ^
    (see https://google.github.io/styleguide/javaguide.html#s6.2-caught-exceptions)

• 11 src/com/github/iusmac/sevensim/launcher/QsAppLauncherTileService.java:35: warning: [ParameterName] `/*bundle=*/` does not match formal parameter name `options`; either fix the name or use a regular comment
                        aIntent, PendingIntent.FLAG_IMMUTABLE, /*bundle=*/ null,
                                                                           ^
    (see https://errorprone.info/bugpattern/ParameterName)
  Did you mean 'aIntent, PendingIntent.FLAG_IMMUTABLE, /* options= */ null,' or 'aIntent, PendingIntent.FLAG_IMMUTABLE, /* bundle */ null,'?

• 12 src/com/github/iusmac/sevensim/SevenSimApplication.java:48: warning: [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
     * @return {@code true} if the application has been signed with the AOSP platform signature,
       ^
    (see https://google.github.io/styleguide/javaguide.html#s7.2-summary-fragment)
  Did you mean '*Returns {@code true} if the application has been signed with the AOSP platform signature,'?

• 13 src/com/github/iusmac/sevensim/SevenSimApplication.java:56: warning: [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
     * @return The string containing the package version.
       ^
    (see https://google.github.io/styleguide/javaguide.html#s7.2-summary-fragment)
  Did you mean '*Returns the string containing the package version.'?

• 14 src/com/github/iusmac/sevensim/SevenSimApplication.java:63: warning: [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
     * @return {@code true} if the application is classified by the OS as a "built-in system"
       ^
    (see https://google.github.io/styleguide/javaguide.html#s7.2-summary-fragment)
  Did you mean '*Returns {@code true} if the application is classified by the OS as a "built-in system"'?

• 15 src/com/github/iusmac/sevensim/ApplicationInfo.java:54: warning: [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
     * @return The string containing the package version.
       ^
    (see https://google.github.io/styleguide/javaguide.html#s7.2-summary-fragment)
  Did you mean '*Returns the string containing the package version.'?

• 16 src/com/github/iusmac/sevensim/ApplicationInfo.java:66: warning: [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
     * @return {@code true} if the application is classified by the OS as a "built-in system"
       ^
    (see https://google.github.io/styleguide/javaguide.html#s7.2-summary-fragment)
  Did you mean '*Returns {@code true} if the application is classified by the OS as a "built-in system"'?

• 17 src/com/github/iusmac/sevensim/ApplicationInfo.java:100: warning: [InvalidParam] Parameter name `context` is unknown.
     * @param context The application context for accessing {@link PackageManager}.
       ^
    (see https://errorprone.info/bugpattern/InvalidParam)
  Did you mean '*'?

• 18 src/com/github/iusmac/sevensim/ApplicationInfo.java:101: warning: [InvalidParam] Parameter name `packageName` is unknown.
     * @param packageName The name of the package to retrieve overall information of.
       ^
    (see https://errorprone.info/bugpattern/InvalidParam)
  Did you mean '*'?

• 19 src/com/github/iusmac/sevensim/NotificationManager.java:96: warning: [EmptyCatch] Caught exceptions should not be ignored
        } catch (SecurityException ignored) {}
          ^
    (see https://google.github.io/styleguide/javaguide.html#s6.2-caught-exceptions)

• 20 src/com/github/iusmac/sevensim/NotificationManager.java:193: warning: [EmptyCatch] Caught exceptions should not be ignored
        } catch (SecurityException ignored) {}
          ^
    (see https://google.github.io/styleguide/javaguide.html#s6.2-caught-exceptions)

• 21 src/com/github/iusmac/sevensim/SystemBroadcastReceiver.java:49: warning: [JavaTimeDefaultTimeZone] LocalDateTime.now() is not allowed because it silently uses the system default time-zone. You must pass an explicit time-zone (e.g., ZoneId.of("America/Los_Angeles")) to this method.
        final LocalDateTime now = LocalDateTime.now();
                                                   ^
    (see https://errorprone.info/bugpattern/JavaTimeDefaultTimeZone)
  Did you mean 'final LocalDateTime now = LocalDateTime.now(ZoneId.systemDefault());'?

• 22 src/com/github/iusmac/sevensim/SystemBroadcastReceiver.java:80: warning: [FallThrough] Execution may fall through from the previous case; add a `// fall through` comment before this line if it was deliberate
                    default:
                    ^
    (see https://errorprone.info/bugpattern/FallThrough)

• 23 src/com/github/iusmac/sevensim/DirectBootAwareBroadcastReceiver.java:44: warning: [JavaTimeDefaultTimeZone] LocalDateTime.now() is not allowed because it silently uses the system default time-zone. You must pass an explicit time-zone (e.g., ZoneId.of("America/Los_Angeles")) to this method.
        final LocalDateTime now = LocalDateTime.now();
                                                   ^
    (see https://errorprone.info/bugpattern/JavaTimeDefaultTimeZone)
  Did you mean 'final LocalDateTime now = LocalDateTime.now(ZoneId.systemDefault());'?

• 24 src/com/github/iusmac/sevensim/SysProp.java:34: warning: [InvalidLink] {@link} cannot be used for HTTP links. Use an <a> tag instead.
     * [3] {@link https://android.googlesource.com/platform/system/sepolicy/+/refs/heads/android-s-beta-4/private/property_contexts#29}
           ^
    (see https://errorprone.info/bugpattern/InvalidLink)
  Did you mean '* [3] <a href="https:'?

• 25 src/com/github/iusmac/sevensim/SysProp.java:32: warning: [UnrecognisedJavadocTag] This Javadoc tag wasn't recognised by the parser. Is it malformed somehow, perhaps with mismatched braces?
     * [1] {@link https://android.googlesource.com/platform/system/sepolicy/+/refs/heads/android-s-beta-4/private/seapp_contexts#140}
           ^
    (see https://errorprone.info/bugpattern/UnrecognisedJavadocTag)

• 26 src/com/github/iusmac/sevensim/SysProp.java:33: warning: [UnrecognisedJavadocTag] This Javadoc tag wasn't recognised by the parser. Is it malformed somehow, perhaps with mismatched braces?
     * [2] {@link https://android.googlesource.com/platform/system/sepolicy/+/refs/heads/android-s-beta-4/private/system_app.te#41}
           ^
    (see https://errorprone.info/bugpattern/UnrecognisedJavadocTag)

• 27 src/com/github/iusmac/sevensim/SysProp.java:34: warning: [UnrecognisedJavadocTag] This Javadoc tag wasn't recognised by the parser. Is it malformed somehow, perhaps with mismatched braces?
     * [3] {@link https://android.googlesource.com/platform/system/sepolicy/+/refs/heads/android-s-beta-4/private/property_contexts#29}
           ^
    (see https://errorprone.info/bugpattern/UnrecognisedJavadocTag)

• 28 src/com/github/iusmac/sevensim/SysProp.java:90: warning: [InvalidParam] Parameter name `val` is unknown. Did you mean value?
     * @param val The value to store in the system property.
       ^
    (see https://errorprone.info/bugpattern/InvalidParam)
  Did you mean '* @param value The value to store in the system property.'?

• 29 src/com/github/iusmac/sevensim/SysProp.java:89: warning: [MissingSummary] A summary line is required on public/protected Javadocs.
     * @see SystemProperties#set(String,String)
       ^
    (see https://google.github.io/styleguide/javaguide.html#s7.2-summary-fragment)

• 30 src/com/github/iusmac/sevensim/SysProp.java:98: warning: [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
     * @see SystemProperties#get(String,String)
       ^
    (see https://google.github.io/styleguide/javaguide.html#s7.2-summary-fragment)
  Did you mean '*Returns the value stored in the system property.'?

• 31 src/com/github/iusmac/sevensim/scheduler/SubscriptionSchedulerSummaryBuilder.java:158: warning: [ParameterName] `/*NumberFormat=*/` does not match formal parameter name `nf`; either fix the name or use a regular comment
                    /*NumberFormat=*/ null, style, displayContext);
                                      ^
    (see https://errorprone.info/bugpattern/ParameterName)
  Did you mean '/* nf= */ null, style, displayContext);' or '/* NumberFormat */ null, style, displayContext);'?

• 32 src/com/github/iusmac/sevensim/scheduler/SubscriptionScheduler.java:181: warning: [EmptyCatch] Caught exceptions should not be ignored
                    } catch (InterruptedException ignored) { }
                      ^
    (see https://google.github.io/styleguide/javaguide.html#s6.2-caught-exceptions)

• 33 src/com/github/iusmac/sevensim/scheduler/SubscriptionScheduler.java:408: warning: [JavaTimeDefaultTimeZone] LocalDateTime.now() is not allowed because it silently uses the system default time-zone. You must pass an explicit time-zone (e.g., ZoneId.of("America/Los_Angeles")) to this method.
        final LocalDateTime now = LocalDateTime.now();
                                                   ^
    (see https://errorprone.info/bugpattern/JavaTimeDefaultTimeZone)
  Did you mean 'final LocalDateTime now = LocalDateTime.now(ZoneId.systemDefault());'?

• 34 src/com/github/iusmac/sevensim/telephony/Subscriptions.java:536: warning: [EmptyCatch] Caught exceptions should not be ignored
            } catch (NumberFormatException e) {}
              ^
    (see https://google.github.io/styleguide/javaguide.html#s6.2-caught-exceptions)

• 35 src/com/github/iusmac/sevensim/telephony/SubscriptionController.java:74: warning: [JavaTimeDefaultTimeZone] LocalDateTime.now() is not allowed because it silently uses the system default time-zone. You must pass an explicit time-zone (e.g., ZoneId.of("America/Los_Angeles")) to this method.
        sub.setLastActivatedTime(enabled ? LocalDateTime.now() : LocalDateTime.MIN);
                                                            ^
    (see https://errorprone.info/bugpattern/JavaTimeDefaultTimeZone)
  Did you mean 'sub.setLastActivatedTime(enabled ? LocalDateTime.now(ZoneId.systemDefault()) : LocalDateTime.MIN);'?

• 36 src/com/github/iusmac/sevensim/telephony/SubscriptionController.java:75: warning: [JavaTimeDefaultTimeZone] LocalDateTime.now() is not allowed because it silently uses the system default time-zone. You must pass an explicit time-zone (e.g., ZoneId.of("America/Los_Angeles")) to this method.
        sub.setLastDeactivatedTime(!enabled ? LocalDateTime.now() : LocalDateTime.MIN);
                                                               ^
    (see https://errorprone.info/bugpattern/JavaTimeDefaultTimeZone)
  Did you mean 'sub.setLastDeactivatedTime(!enabled ? LocalDateTime.now(ZoneId.systemDefault()) : LocalDateTime.MIN);'?

• 37 src/com/github/iusmac/sevensim/telephony/TelephonyController.java:149: warning: [JavaTimeDefaultTimeZone] LocalDateTime.now() is not allowed because it silently uses the system default time-zone. You must pass an explicit time-zone (e.g., ZoneId.of("America/Los_Angeles")) to this method.
            sub.setLastActivatedTime(enabled ? LocalDateTime.now() : LocalDateTime.MIN);
                                                                ^
    (see https://errorprone.info/bugpattern/JavaTimeDefaultTimeZone)
  Did you mean 'sub.setLastActivatedTime(enabled ? LocalDateTime.now(ZoneId.systemDefault()) : LocalDateTime.MIN);'?

• 38 src/com/github/iusmac/sevensim/telephony/TelephonyController.java:150: warning: [JavaTimeDefaultTimeZone] LocalDateTime.now() is not allowed because it silently uses the system default time-zone. You must pass an explicit time-zone (e.g., ZoneId.of("America/Los_Angeles")) to this method.
            sub.setLastDeactivatedTime(!enabled ? LocalDateTime.now() : LocalDateTime.MIN);
                                                                   ^
    (see https://errorprone.info/bugpattern/JavaTimeDefaultTimeZone)
  Did you mean 'sub.setLastDeactivatedTime(!enabled ? LocalDateTime.now(ZoneId.systemDefault()) : LocalDateTime.MIN);'?

• 39 src/com/github/iusmac/sevensim/telephony/TelephonyController.java:172: warning: [WaitNotInLoop] Because of spurious wakeups, wait(long) must always be called in a loop
                wait(SET_SIM_POWER_STATE_REQUEST_TIMEOUT_MILLIS);
                    ^
    (see https://errorprone.info/bugpattern/WaitNotInLoop)

• 40 src/com/github/iusmac/sevensim/telephony/TelephonyUtils.java:153: warning: [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
     * @param context The context to access content resolver.
       ^
    (see https://google.github.io/styleguide/javaguide.html#s7.2-summary-fragment)
  Did you mean '*Returns {@code true} if the "Airplane mode" is enabled, otherwise {@code false}.'?

• 41 src/com/github/iusmac/sevensim/telephony/TelephonyUtils.java:162: warning: [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
     * @return {@code true} if PIN string meets the UICC specs, otherwise {@code false}.
       ^
    (see https://google.github.io/styleguide/javaguide.html#s7.2-summary-fragment)
  Did you mean '*Returns {@code true} if PIN string meets the UICC specs, otherwise {@code false}.'?

• 42 src/com/github/iusmac/sevensim/telephony/PinStorage.java:187: warning: [DefaultCharset] Implicit use of the platform default charset, which can result in differing behaviour between JVM executions or incorrect behavior if the encoding of the data source doesn't match expectations.
            pinEntity.setData(cipher.doFinal(clearPin.getBytes()));
                                                              ^
    (see https://errorprone.info/bugpattern/DefaultCharset)
  Did you mean 'pinEntity.setData(cipher.doFinal(clearPin.getBytes(UTF_8)));' or 'pinEntity.setData(cipher.doFinal(clearPin.getBytes(Charset.defaultCharset())));'?

• 43 src/com/github/iusmac/sevensim/telephony/PinStorage.java:231: warning: [DefaultCharset] Implicit use of the platform default charset, which can result in differing behaviour between JVM executions or incorrect behavior if the encoding of the data source doesn't match expectations.
            pinEntity.setClearPin(new String(cipher.doFinal(pinEntity.getData())));
                                  ^
    (see https://errorprone.info/bugpattern/DefaultCharset)
  Did you mean 'pinEntity.setClearPin(new String(cipher.doFinal(pinEntity.getData()), UTF_8));' or 'pinEntity.setClearPin(new String(cipher.doFinal(pinEntity.getData()), Charset.defaultCharset()));'?

• 44 src/com/github/iusmac/sevensim/telephony/SubscriptionsImplLegacy.java:282: warning: [ProtectedMembersInFinalClass] Make members of final classes package-private: persistSimSubId, persistSimState, persistSimTintColor, persistSimName
    protected void persistSimSubId(final int slotIndex, final int subId) {
                   ^
    (see https://errorprone.info/bugpattern/ProtectedMembersInFinalClass)
  Did you mean 'void persistSimSubId(final int slotIndex, final int subId) {'?

• 45 src/com/github/iusmac/sevensim/telephony/SubscriptionsImplLegacy.java:213: warning: [EmptyCatch] Caught exceptions should not be ignored
            } catch (NumberFormatException e) {}
              ^
    (see https://google.github.io/styleguide/javaguide.html#s6.2-caught-exceptions)

• 46 src/com/github/iusmac/sevensim/telephony/SubscriptionsImplLegacy.java:238: warning: [EmptyCatch] Caught exceptions should not be ignored
            } catch (NumberFormatException e) {}
              ^
    (see https://google.github.io/styleguide/javaguide.html#s6.2-caught-exceptions)

• 47 src/com/github/iusmac/sevensim/telephony/SubscriptionsImplLegacy.java:257: warning: [EmptyCatch] Caught exceptions should not be ignored
            } catch (NumberFormatException e) {}
              ^
    (see https://google.github.io/styleguide/javaguide.html#s6.2-caught-exceptions)

• 48 src/com/github/iusmac/sevensim/scheduler/AlarmReceiver.java:56: warning: [JavaTimeDefaultTimeZone] LocalDateTime.now() is not allowed because it silently uses the system default time-zone. You must pass an explicit time-zone (e.g., ZoneId.of("America/Los_Angeles")) to this method.
        final LocalDateTime now = LocalDateTime.now();
                                                   ^
    (see https://errorprone.info/bugpattern/JavaTimeDefaultTimeZone)
  Did you mean 'final LocalDateTime now = LocalDateTime.now(ZoneId.systemDefault());'?

• 49 src/com/github/iusmac/sevensim/ForegroundService.java:226: warning: [MissingSummary] A summary fragment is required; consider using the value of the @see block as a summary fragment instead.
    /** @see SimPinFeeder */
        ^
    (see https://google.github.io/styleguide/javaguide.html#s7.2-summary-fragment)
  Did you mean '/** See {@link SimPinFeeder}.'?

• 50 src/com/github/iusmac/sevensim/Utils.java:21: warning: [MissingSummary] A summary line is required on public/protected Javadocs.
     * @param context The application context.
       ^
    (see https://google.github.io/styleguide/javaguide.html#s7.2-summary-fragment)

• 51 src/com/github/iusmac/sevensim/UserAuthenticationObserverService.java:260: warning: [ClassCanBeStatic] Inner class is non-static but does not reference enclosing class
    private final class PendingTask {
                  ^
    (see https://errorprone.info/bugpattern/ClassCanBeStatic)
  Did you mean 'private static final class PendingTask {'?

• 52 src/com/github/iusmac/sevensim/RoomTypeConverters.java:31: warning: [EmptyCatch] Caught exceptions should not be ignored
        } catch (DateTimeParseException ignored) {}
          ^
    (see https://google.github.io/styleguide/javaguide.html#s6.2-caught-exceptions)

• 53 src/com/github/iusmac/sevensim/DateTimeUtils.java:40: warning: [EmptyCatch] Caught exceptions should not be ignored
        } catch (DateTimeParseException ignored) { }
          ^
    (see https://google.github.io/styleguide/javaguide.html#s6.2-caught-exceptions)

• 54 src/com/github/iusmac/sevensim/DateTimeUtils.java:45: warning: [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
     * @param context The context for detecting the 12-/24-hour format.
       ^
    (see https://google.github.io/styleguide/javaguide.html#s7.2-summary-fragment)
  Did you mean '*Returns the time in pretty format, such as 10:00 AM.'?

• 55 src/com/github/iusmac/sevensim/ui/components/ItemAdapter.java:153: warning: [ReferenceEquality] Comparison using reference equality instead of value equality
                if (t0.itemId == t1.itemId && t0 != t1) {
                                                 ^
    (see https://errorprone.info/bugpattern/ReferenceEquality)
  Did you mean 'if (t0.itemId == t1.itemId && !t0.equals(t1)) {'?

• 56 src/com/github/iusmac/sevensim/ui/components/ItemAdapter.java:209: warning: [InvalidParam] Parameter name `itemHolder` is unknown. Did you mean itemHolders?
     * @param itemHolder the item holder to add or update
       ^
    (see https://errorprone.info/bugpattern/InvalidParam)
  Did you mean '* @param itemHolders the item holder to add or update'?

• 57 src/com/github/iusmac/sevensim/ui/components/ItemAdapter.java:249: warning: [InvalidParam] Parameter name `index` is unknown.
     * @param index The index of the item to be removed.
       ^
    (see https://errorprone.info/bugpattern/InvalidParam)
  Did you mean '*'?

• 58 src/com/github/iusmac/sevensim/ui/components/ItemAdapter.java:302: warning: [MissingSummary] A summary line is required on public/protected Javadocs.
     * @param position The current item position whose position should be re-calculated according to
       ^
    (see https://google.github.io/styleguide/javaguide.html#s7.2-summary-fragment)

• 59 src/com/github/iusmac/sevensim/ui/components/ItemAdapter.java:383: warning: [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
         * @return the unique identifier for the view that should be used to represent the item,
           ^
    (see https://google.github.io/styleguide/javaguide.html#s7.2-summary-fragment)
  Did you mean '*Returns the unique identifier for the view that should be used to represent the item,'?

• 60 src/com/github/iusmac/sevensim/ui/components/ItemAdapter.java:456: warning: [EqualsGetClass] Prefer instanceof to getClass when implementing Object#equals.
        public boolean equals(final Object o) {
                       ^
    (see https://errorprone.info/bugpattern/EqualsGetClass)
  Did you mean 'if (!(o instanceof ItemHolder)) return false;'?

• 61 src/com/github/iusmac/sevensim/ui/components/ItemAdapter.java:492: warning: [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
         * @return the current {@link ItemHolder} bound to this holder, or {@code null} if unbound
           ^
    (see https://google.github.io/styleguide/javaguide.html#s7.2-summary-fragment)
  Did you mean '*Returns the current {@link ItemHolder} bound to this holder, or {@code null} if unbound.'?

• 62 src/com/github/iusmac/sevensim/ui/components/CollapsingToolbarBaseActivity.java:79: warning: [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
     * @return The {@link ViewModel} instance created via {@link #onCreateViewModel()}.
       ^
    (see https://google.github.io/styleguide/javaguide.html#s7.2-summary-fragment)
  Did you mean '*Returns the {@link ViewModel} instance created via {@link #onCreateViewModel()}.'?

• 63 src/com/github/iusmac/sevensim/ui/scheduler/SchedulerViewModel.java:115: warning: [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
     * @return An observable human-readable string summarizing the next upcoming schedule for this
       ^
    (see https://google.github.io/styleguide/javaguide.html#s7.2-summary-fragment)
  Did you mean '*Returns an observable human-readable string summarizing the next upcoming schedule for this'?

• 64 src/com/github/iusmac/sevensim/ui/scheduler/SchedulerViewModel.java:123: warning: [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
     * @return An observable containing the list of schedules, if any.
       ^
    (see https://google.github.io/styleguide/javaguide.html#s7.2-summary-fragment)
  Did you mean '*Returns an observable containing the list of schedules, if any.'?

• 65 src/com/github/iusmac/sevensim/ui/scheduler/SchedulerViewModel.java:130: warning: [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
     * @return An observable containing the most recently added schedule, if any.
       ^
    (see https://google.github.io/styleguide/javaguide.html#s7.2-summary-fragment)
  Did you mean '*Returns an observable containing the most recently added schedule, if any.'?

• 66 src/com/github/iusmac/sevensim/ui/scheduler/SchedulerViewModel.java:137: warning: [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
     * @return An observable containing the PIN presence status.
       ^
    (see https://google.github.io/styleguide/javaguide.html#s7.2-summary-fragment)
  Did you mean '*Returns an observable containing the PIN presence status.'?

• 67 src/com/github/iusmac/sevensim/ui/scheduler/SchedulerViewModel.java:148: warning: [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
     * @return An observable lock state of the SIM PIN task.
       ^
    (see https://google.github.io/styleguide/javaguide.html#s7.2-summary-fragment)
  Did you mean '*Returns an observable lock state of the SIM PIN task.'?

• 68 src/com/github/iusmac/sevensim/ui/scheduler/SchedulerViewModel.java:155: warning: [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
     * @return An observable containing a human-readable PIN error message, if any.
       ^
    (see https://google.github.io/styleguide/javaguide.html#s7.2-summary-fragment)
  Did you mean '*Returns an observable containing a human-readable PIN error message, if any.'?

• 69 src/com/github/iusmac/sevensim/ui/scheduler/SchedulerViewModel.java:323: warning: [JavaTimeDefaultTimeZone] LocalDateTime.now() is not allowed because it silently uses the system default time-zone. You must pass an explicit time-zone (e.g., ZoneId.of("America/Los_Angeles")) to this method.
                    LocalDateTime.now().plusMinutes(1), pinEntities);
                                     ^
    (see https://errorprone.info/bugpattern/JavaTimeDefaultTimeZone)
  Did you mean 'LocalDateTime.now(ZoneId.systemDefault()).plusMinutes(1), pinEntities);'?

• 70 src/com/github/iusmac/sevensim/ui/scheduler/SchedulerViewModel.java:340: warning: [JavaTimeDefaultTimeZone] LocalDateTime.now() is not allowed because it silently uses the system default time-zone. You must pass an explicit time-zone (e.g., ZoneId.of("America/Los_Angeles")) to this method.
                    .buildNextUpcomingSubscriptionScheduleSummary(sub, LocalDateTime.now()))
                                                                                        ^
    (see https://errorprone.info/bugpattern/JavaTimeDefaultTimeZone)
  Did you mean '.buildNextUpcomingSubscriptionScheduleSummary(sub, LocalDateTime.now(ZoneId.systemDefault())))'?

• 71 src/com/github/iusmac/sevensim/ui/scheduler/SchedulerViewModel.java:357: warning: [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
     * @return {@code true} if the SIM PIN code has been set, otherwise {@code false}.
       ^
    (see https://google.github.io/styleguide/javaguide.html#s7.2-summary-fragment)
  Did you mean '*Returns {@code true} if the SIM PIN code has been set, otherwise {@code false}.'?

• 72 src/com/github/iusmac/sevensim/ui/scheduler/SchedulerViewModel.java:364: warning: [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
     * @return {@code true} if we need to authenticate the user with their credentials for further
       ^
    (see https://google.github.io/styleguide/javaguide.html#s7.2-summary-fragment)
  Did you mean '*Returns {@code true} if we need to authenticate the user with their credentials for further'?

• 73 src/com/github/iusmac/sevensim/ui/scheduler/SchedulerViewModel.java:412: warning: [ClassCanBeStatic] Inner class is non-static but does not reference enclosing class
    final class PinErrorMessage {
          ^
    (see https://errorprone.info/bugpattern/ClassCanBeStatic)
  Did you mean 'static final class PinErrorMessage {'?

• 74 src/com/github/iusmac/sevensim/ui/scheduler/SchedulerViewModel.java:452: warning: [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
     * @param assistedFactory An {@link AssistedFactory} to create the {@link SchedulerViewModel}
       ^
    (see https://google.github.io/styleguide/javaguide.html#s7.2-summary-fragment)
  Did you mean '*Returns an instance of the {@link ViewModelProvider}.'?

• 75 src/com/github/iusmac/sevensim/ui/components/toolbar/ToolbarDecorator.java:65: warning: [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
     * @return Whether the framework's {@link Toolbar} widget is wrapped by a
       ^
    (see https://google.github.io/styleguide/javaguide.html#s7.2-summary-fragment)
  Did you mean '*Returns whether the framework's {@link Toolbar} widget is wrapped by a'?

• 76 src/com/github/iusmac/sevensim/ui/components/toolbar/ToolbarDecorator.java:127: warning: [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
     * @return An Optional containing the title marquee repeat limit, if any.
       ^
    (see https://google.github.io/styleguide/javaguide.html#s7.2-summary-fragment)
  Did you mean '*Returns an Optional containing the title marquee repeat limit, if any.'?

• 77 src/com/github/iusmac/sevensim/ui/components/toolbar/ToolbarDecorator.java:148: warning: [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
     * @return An Optional containing the subtitle marquee repeat limit, if any.
       ^
    (see https://google.github.io/styleguide/javaguide.html#s7.2-summary-fragment)
  Did you mean '*Returns an Optional containing the subtitle marquee repeat limit, if any.'?

• 78 src/com/github/iusmac/sevensim/ui/components/toolbar/ToolbarDecorator.java:173: warning: [MissingSummary] A summary line is required on public/protected Javadocs.
     * @param mode The mode for {@link View#setImportantForAccessibility(int)}.
       ^
    (see https://google.github.io/styleguide/javaguide.html#s7.2-summary-fragment)

• 79 src/com/github/iusmac/sevensim/ui/components/toolbar/ToolbarDecorator.java:305: warning: [ParameterName] `/*startValue=*/` does not match formal parameter name `outputMin`; either fix the name or use a regular comment
                    /*startValue=*/ 0,
                                    ^
    (see https://errorprone.info/bugpattern/ParameterName)
  Did you mean '/* outputMin= */ 0,' or '/* startValue */ 0,'?

• 80 src/com/github/iusmac/sevensim/ui/components/toolbar/ToolbarDecorator.java:306: warning: [ParameterName] `/*endValue=*/` does not match formal parameter name `outputMax`; either fix the name or use a regular comment
                    /*endValue=*/ 1,
                                  ^
    (see https://errorprone.info/bugpattern/ParameterName)
  Did you mean '/* outputMax= */ 1,' or '/* endValue */ 1,'?

• 81 src/com/github/iusmac/sevensim/ui/components/toolbar/ToolbarDecorator.java:307: warning: [ParameterName] `/*startFraction=*/` does not match formal parameter name `inputMin`; either fix the name or use a regular comment
                    /*startFraction=*/ fadeThresholdFraction,
                                       ^
    (see https://errorprone.info/bugpattern/ParameterName)
  Did you mean '/* inputMin= */ fadeThresholdFraction,' or '/* startFraction */ fadeThresholdFraction,'?

• 82 src/com/github/iusmac/sevensim/ui/components/toolbar/ToolbarDecorator.java:308: warning: [ParameterName] `/*endFraction=*/` does not match formal parameter name `inputMax`; either fix the name or use a regular comment
                    /*endFraction=*/ 1,
                                     ^
    (see https://errorprone.info/bugpattern/ParameterName)
  Did you mean '/* inputMax= */ 1,' or '/* endFraction */ 1,'?

• 83 src/com/github/iusmac/sevensim/ui/components/toolbar/ToolbarDecorator.java:324: warning: [ParameterName] `/*startValue=*/` does not match formal parameter name `outputMin`; either fix the name or use a regular comment
                    /*startValue=*/ 1,
                                    ^
    (see https://errorprone.info/bugpattern/ParameterName)
  Did you mean '/* outputMin= */ 1,' or '/* startValue */ 1,'?

• 84 src/com/github/iusmac/sevensim/ui/components/toolbar/ToolbarDecorator.java:325: warning: [ParameterName] `/*endValue=*/` does not match formal parameter name `outputMax`; either fix the name or use a regular comment
                    /*endValue=*/ 0,
                                  ^
    (see https://errorprone.info/bugpattern/ParameterName)
  Did you mean '/* outputMax= */ 0,' or '/* endValue */ 0,'?

• 85 src/com/github/iusmac/sevensim/ui/components/toolbar/ToolbarDecorator.java:326: warning: [ParameterName] `/*startFraction=*/` does not match formal parameter name `inputMin`; either fix the name or use a regular comment
                    /*startFraction=*/ fadeStartFraction,
                                       ^
    (see https://errorprone.info/bugpattern/ParameterName)
  Did you mean '/* inputMin= */ fadeStartFraction,' or '/* startFraction */ fadeStartFraction,'?

• 86 src/com/github/iusmac/sevensim/ui/components/toolbar/ToolbarDecorator.java:327: warning: [ParameterName] `/*endFraction=*/` does not match formal parameter name `inputMax; either fix the name or use a regular comment
                    /*endFraction=*/ fadeThresholdFraction,
                                     ^
    (see https://errorprone.info/bugpattern/ParameterName)
  Did you mean '/* inputMax= */ fadeThresholdFraction,' or '/* endFraction */ fadeThresholdFraction,'?

• 87 src/com/github/iusmac/sevensim/ui/scheduler/SchedulerFragment.java:212: warning: [ParameterName] `/*container=*/` does not match formal parameter name `root`; either fix the name or use a regular comment
            inflater.inflate(R.layout.scheduler_fabs, /*container=*/ null, false);
                                                                     ^
    (see https://errorprone.info/bugpattern/ParameterName)
  Did you mean 'inflater.inflate(R.layout.scheduler_fabs, /* root= */ null, false);' or 'inflater.inflate(R.layout.scheduler_fabs, /* container */ null, false);'?

• 88 src/com/github/iusmac/sevensim/ui/scheduler/SchedulerFragment.java:394: warning: [JavaTimeDefaultTimeZone] LocalTime.now() is not allowed because it silently uses the system default time-zone. You must pass an explicit time-zone (e.g., ZoneId.of("America/Los_Angeles")) to this method.
        showTimePicker(LocalTime.now());
                                    ^
    (see https://errorprone.info/bugpattern/JavaTimeDefaultTimeZone)
  Did you mean 'showTimePicker(LocalTime.now(ZoneId.systemDefault()));'?

• 89 src/com/github/iusmac/sevensim/ui/scheduler/SchedulerFragment.java:482: warning: [ParameterName] `/*paylaod=*/` does not match formal parameter name `payload`; either fix the name or use a regular comment
            authenticateAndRunAction(ACTION_AUTH_HANDLE_ON_SCHEDULE_DELETED, /*paylaod=*/ null);
                                                                                          ^
    (see https://errorprone.info/bugpattern/ParameterName)
  Did you mean 'authenticateAndRunAction(ACTION_AUTH_HANDLE_ON_SCHEDULE_DELETED, /* payload= */ null);' or 'authenticateAndRunAction(ACTION_AUTH_HANDLE_ON_SCHEDULE_DELETED, /* paylaod */ null);'?

• 90 src/com/github/iusmac/sevensim/ui/scheduler/SchedulerFragment.java:643: warning: [InvalidParam] Parameter name `extras` is unknown.
     * @param extras The Bundle holding payload data.
       ^
    (see https://errorprone.info/bugpattern/InvalidParam)
  Did you mean '*'?

• 91 src/com/github/iusmac/sevensim/ui/scheduler/SchedulerFragment.java:788: warning: [LogicalAssignment] Assignment where a boolean expression was expected; use == if this assignment wasn't expected or add parentheses for clarity.
            if (mPinPopupMenuVisible = savedInstanceState.getBoolean(SAVED_PIN_POPUP_VISIBLE)) {
                                     ^
    (see https://errorprone.info/bugpattern/LogicalAssignment)
  Did you mean 'if ((mPinPopupMenuVisible = savedInstanceState.getBoolean(SAVED_PIN_POPUP_VISIBLE))) {' or 'if (mPinPopupMenuVisible == savedInstanceState.getBoolean(SAVED_PIN_POPUP_VISIBLE)) {'?

• 92 src/com/github/iusmac/sevensim/ui/UiUtils.java:145: warning: [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
     * @param context The {@link Context} to access resources.
       ^
    (see https://google.github.io/styleguide/javaguide.html#s7.2-summary-fragment)
  Did you mean '*Returns a tinted {@link Drawable}, cached instance in most cases.'?

• 93 src/com/github/iusmac/sevensim/ui/UiUtils.java:193: warning: [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
     * @param amPmRatio A value between 0 and 1 that is the ratio of the relative size of the am/pm
       ^
    (see https://google.github.io/styleguide/javaguide.html#s7.2-summary-fragment)
  Did you mean '*Returns the format string for 12 hours mode time, not including seconds.'?

• 94 src/com/github/iusmac/sevensim/ui/UiUtils.java:203: warning: [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
     * @param amPmRatio A value between 0 and 1 that is the ratio of the relative size of the am/pm
       ^
    (see https://google.github.io/styleguide/javaguide.html#s7.2-summary-fragment)
  Did you mean '*Returns the Format string for 12 hours mode time, not including seconds.'?

• 95 src/com/github/iusmac/sevensim/ui/UiUtils.java:321: warning: [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
     * @param context The {@link Context} to access resources.
       ^
    (see https://google.github.io/styleguide/javaguide.html#s7.2-summary-fragment)
  Did you mean '*Returns whether the currently the app is displayed in landscape orientation.'?

• 96 src/com/github/iusmac/sevensim/ui/UiUtils.java:330: warning: [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
     * @param context The {@link Context} to access resources.
       ^
    (see https://google.github.io/styleguide/javaguide.html#s7.2-summary-fragment)
  Did you mean '*Returns whether the currently the app is displayed in landscape orientation.'?

• 97 src/com/github/iusmac/sevensim/ui/components/TimePickerDialogFragment.java:89: warning: [JavaTimeDefaultTimeZone] LocalTime.now() is not allowed because it silently uses the system default time-zone. You must pass an explicit time-zone (e.g., ZoneId.of("America/Los_Angeles")) to this method.
            final LocalTime lt = LocalTime.now();
                                              ^
    (see https://errorprone.info/bugpattern/JavaTimeDefaultTimeZone)
  Did you mean 'final LocalTime lt = LocalTime.now(ZoneId.systemDefault());'?

• 98 src/com/github/iusmac/sevensim/ui/sim/SimListViewModel.java:68: warning: [JavaTimeDefaultTimeZone] LocalDateTime.now() is not allowed because it silently uses the system default time-zone. You must pass an explicit time-zone (e.g., ZoneId.of("America/Los_Angeles")) to this method.
        final LocalDateTime now = LocalDateTime.now();
                                                   ^
    (see https://errorprone.info/bugpattern/JavaTimeDefaultTimeZone)
  Did you mean 'final LocalDateTime now = LocalDateTime.now(ZoneId.systemDefault());'?

• 99 src/com/github/iusmac/sevensim/ui/sim/SimListViewModel.java:111: warning: [ClassCanBeStatic] Inner class is non-static but does not reference enclosing class
    final class SimEntry {
          ^
    (see https://errorprone.info/bugpattern/ClassCanBeStatic)
  Did you mean 'static final class SimEntry {'?

• 100 src/com/github/iusmac/sevensim/ui/sim/SimListViewModel.java:137: warning: [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
     * @param assistedFactory An {@link AssistedFactory} to create the {@link SimListViewModel}
       ^
    (see https://google.github.io/styleguide/javaguide.html#s7.2-summary-fragment)
  Did you mean '*Returns an instance of the {@link ViewModelProvider}.'?

• 101 src/com/github/iusmac/sevensim/ui/sim/SimListActivity.java:44: warning: [BadImport] Importing nested classes/static methods/static fields with commonly-used names can make code harder to read, because it may not be clear from the context exactly which type is being referred to. Qualifying the name with that of the containing class can make the code clearer. Here we recommend using qualified class: SimListViewModel.
    Factory mSimListViewModelFactory;
    ^
    (see https://errorprone.info/bugpattern/BadImport)
  Did you mean 'SimListViewModel.Factory mSimListViewModelFactory;'?

Signed-off-by: iusmac <[email protected]>
  • Loading branch information
iusmac committed Aug 21, 2024
1 parent 9fe7d77 commit 46f7f21
Show file tree
Hide file tree
Showing 34 changed files with 157 additions and 112 deletions.
8 changes: 3 additions & 5 deletions src/com/github/iusmac/sevensim/ApplicationInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public boolean hasAospPlatformSignature() {
}

/**
* @return The string containing the package version.
* Return the string containing the package version.
*/
public @NonNull String getPackageVersionName() {
try {
Expand All @@ -63,7 +63,7 @@ public boolean hasAospPlatformSignature() {
}

/**
* @return {@code true} if the application is classified by the OS as a "built-in system"
* Return {@code true} if the application is classified by the OS as a "built-in system"
* application, {@code false} otherwise.
*/
public boolean isSystemApplication() {
Expand Down Expand Up @@ -97,9 +97,7 @@ public Intent getAppBatterySettingsActivityIntent() {
}

/**
* @param context The application context for accessing {@link PackageManager}.
* @param packageName The name of the package to retrieve overall information of.
* @return The array containing package {@link Signature}s.
* Return the array containing package {@link Signature}s.
*/
private Signature[] getPackageSigners() {
try {
Expand Down
5 changes: 3 additions & 2 deletions src/com/github/iusmac/sevensim/DateTimeUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,16 @@ public static Optional<LocalDateTime> parseDateTime(final @Nullable String dateT
if (dateTime != null) {
return Optional.of(LocalDateTime.parse(dateTime));
}
} catch (DateTimeParseException ignored) { }
} catch (DateTimeParseException ignored) { /* @SuppressWarnings("EmptyCatch") */ }
return Optional.empty();
}

/**
* Get the {@link LocalTime} in pretty format, such as 10:00 AM.
*
* @param context The context for detecting the 12-/24-hour format.
* @param time The {@link LocalTime} to express in human-readable format according to the
* current locale.
* @return The time in pretty format, such as 10:00 AM.
*/
public static @NonNull CharSequence getPrettyTime(final @NonNull Context context,
final @NonNull LocalTime time) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import dagger.hilt.android.AndroidEntryPoint;

import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.Optional;

import javax.inject.Inject;
Expand Down Expand Up @@ -41,7 +42,7 @@ public void onReceive(final Context context, final Intent intent) {

mLogger.d("onReceive() : intent=" + intent);

final LocalDateTime now = LocalDateTime.now();
final LocalDateTime now = LocalDateTime.now(ZoneId.systemDefault());
final String action = intent.getAction() != null ? intent.getAction() : "";
switch (action) {
case Intent.ACTION_LOCKED_BOOT_COMPLETED:
Expand Down
2 changes: 1 addition & 1 deletion src/com/github/iusmac/sevensim/ForegroundService.java
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ public static void onSubscriptionsChanged(final Context context, final LocalDate
startAction(context, i);
}

/** @see SimPinFeeder */
/** See {@link SimPinFeeder}. */
public static void unlockSimCards(final Context context, final Bundle clearPinCodes) {
final Intent i = new Intent(ACTION_UNLOCK_SIM_CARDS);
i.putExtra(EXTRA_CLEAR_PIN_CODES, clearPinCodes);
Expand Down
4 changes: 2 additions & 2 deletions src/com/github/iusmac/sevensim/NotificationManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ void showBackgroundRestrictedNotification() {

try {
mNotificationManagerCompat.notify(BACKGROUND_RESTRICTED_NOTIFICATION_ID, notification);
} catch (SecurityException ignored) {}
} catch (SecurityException ignored) { /* @SuppressWarnings("EmptyCatch") */ }
}

/**
Expand Down Expand Up @@ -190,7 +190,7 @@ private void showSimPinErrorNotification(final Subscription sub, final String re
try {
mNotificationManagerCompat.notify(SIM_PIN_ERROR_BASE_NOTIFICATION_ID + sub.getId(),
notification);
} catch (SecurityException ignored) {}
} catch (SecurityException ignored) { /* @SuppressWarnings("EmptyCatch") */ }
}

/** Prepare a channel for foreground notifications. */
Expand Down
2 changes: 1 addition & 1 deletion src/com/github/iusmac/sevensim/RoomTypeConverters.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public RoomTypeConverters(final DaysOfWeek.Factory daysOfWeekFactory) {
if (dateTime != null) {
return LocalDateTime.parse(dateTime);
}
} catch (DateTimeParseException ignored) {}
} catch (DateTimeParseException ignored) { /* @SuppressWarnings("EmptyCatch") */ }
return null;
}

Expand Down
6 changes: 3 additions & 3 deletions src/com/github/iusmac/sevensim/SevenSimApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,22 +45,22 @@ public void onCreate() {
}

/**
* @return {@code true} if the application has been signed with the AOSP platform signature,
* Return {@code true} if the application has been signed with the AOSP platform signature,
* {@code false} otherwise.
*/
public boolean hasAospPlatformSignature() {
return mHasAospPlatformSignature;
}

/**
* @return The string containing the package version.
* Return the string containing the package version.
*/
public @NonNull String getPackageVersionName() {
return mApplicationVersion;
}

/**
* @return {@code true} if the application is classified by the OS as a "built-in system"
* Return {@code true} if the application is classified by the OS as a "built-in system"
* application, {@code false} otherwise.
*/
public boolean isSystemApplication() {
Expand Down
19 changes: 12 additions & 7 deletions src/com/github/iusmac/sevensim/SysProp.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ public final class SysProp {
* defined in [3].
*
* <p>
* [1] {@link https://android.googlesource.com/platform/system/sepolicy/+/refs/heads/android-s-beta-4/private/seapp_contexts#140}
* [2] {@link https://android.googlesource.com/platform/system/sepolicy/+/refs/heads/android-s-beta-4/private/system_app.te#41}
* [3] {@link https://android.googlesource.com/platform/system/sepolicy/+/refs/heads/android-s-beta-4/private/property_contexts#29}
* [1] <a href="https://android.googlesource.com/platform/system/sepolicy/+/refs/heads/android-s-beta-4/private/seapp_contexts#140">platform/system/sepolicy/private/seapp_contexts<a/>
* [2] <a href="https://android.googlesource.com/platform/system/sepolicy/+/refs/heads/android-s-beta-4/private/system_app.te#41">platform/system/sepolicy/private/system_app.te</a>
* [3] <a href="https://android.googlesource.com/platform/system/sepolicy/+/refs/heads/android-s-beta-4/private/property_contexts#29">platform/system/sepolicy/private/property_contexts</a>
*/
private final String SYSTEM_PROP_BASE_CONTEXT = "service.";

Expand Down Expand Up @@ -86,19 +86,24 @@ private String getFormattedProp(final Object... formatArgs) {
}

/**
* @see SystemProperties#set(String,String)
* @param val The value to store in the system property.
* Set the system property to a value, if any.
*
* @param value The value to store in the system property.
* @param formatArgs Values to fill format specifiers in the property name.
*
* @see SystemProperties#set(String,String)
*/
public void set(final Optional<String> value, final Object... formatArgs) {
SystemProperties.set(getFormattedProp(formatArgs), value.orElse(null));
}

/**
* @see SystemProperties#get(String,String)
* Get the value stored in the system property.
*
* @param def The default value in case the property is not set or empty.
* @param formatArgs Values to fill format specifiers in the property name.
* @return The value stored in the system property.
*
* @see SystemProperties#get(String,String)
*/
public Optional<String> get(final Optional<String> def, final Object... formatArgs) {
final String value = SystemProperties.get(getFormattedProp(formatArgs), def.orElse(null));
Expand Down
4 changes: 3 additions & 1 deletion src/com/github/iusmac/sevensim/SystemBroadcastReceiver.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import dagger.hilt.android.AndroidEntryPoint;

import java.time.LocalDateTime;
import java.time.ZoneId;

import javax.inject.Inject;
import javax.inject.Provider;
Expand Down Expand Up @@ -46,7 +47,7 @@ public void onReceive(final Context context, final Intent intent) {

mLogger.d("onReceive() : intent=" + intent);

final LocalDateTime now = LocalDateTime.now();
final LocalDateTime now = LocalDateTime.now(ZoneId.systemDefault());
final String action = intent.getAction() != null ? intent.getAction() : "";
switch (action) {
case Intent.ACTION_BOOT_COMPLETED:
Expand Down Expand Up @@ -77,6 +78,7 @@ public void onReceive(final Context context, final Intent intent) {
break;
}

// fall through
default:
ForegroundService.updateNextWeeklyRepeatScheduleProcessingIter(context,
now.plusMinutes(1), /*decryptPinStorage=*/ true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ void shutdown() {
* A holder class representing a pending intent associated with its ID (aka startId), that will
* be processed via {@link #handleIntent(Intent)} when the {@link Worker} starts.
*/
private final class PendingTask {
private static final class PendingTask {
final int id;
final Intent intent;

Expand Down
2 changes: 2 additions & 0 deletions src/com/github/iusmac/sevensim/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ public final class Utils {
Build.VERSION_CODES.UPSIDE_DOWN_CAKE;

/**
* Make a standard toast with long duration.
*
* @param context The application context.
* @param msg The toast message to show.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public void onClick() {
aIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
if (Utils.IS_AT_LEAST_U) {
startActivityAndCollapse(PendingIntent.getActivityAsUser(this, /*requestCode=*/ 0,
aIntent, PendingIntent.FLAG_IMMUTABLE, /*bundle=*/ null,
aIntent, PendingIntent.FLAG_IMMUTABLE, /*options=*/ null,
UserHandle.CURRENT));
} else {
ApiDeprecated.startActivityAndCollapse(this, aIntent);
Expand Down
3 changes: 2 additions & 1 deletion src/com/github/iusmac/sevensim/scheduler/AlarmReceiver.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import dagger.hilt.android.AndroidEntryPoint;

import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.List;

import javax.inject.Inject;
Expand Down Expand Up @@ -53,7 +54,7 @@ public void onReceive(final Context context, final Intent intent) {

mLogger.d("onReceive() : isBgRestricted=%s,intent=%s.", isBgRestricted, intent);

final LocalDateTime now = LocalDateTime.now();
final LocalDateTime now = LocalDateTime.now(ZoneId.systemDefault());
final Bundle clearPinCodes = intent.getExtras();

ForegroundService.syncAllSubscriptionsEnabledState(context, now,
Expand Down
21 changes: 12 additions & 9 deletions src/com/github/iusmac/sevensim/scheduler/DaysOfWeek.java
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,9 @@ public final class DaysOfWeek implements Iterable<Integer>, Comparable<DaysOfWee
}

/**
* Return {@link DayOfWeek} encoded in bits as if returned by {@link #getBits()}.
*
* @param daysOfWeek Any or all of the {@link DayOfWeek} values.
* @return The {@link DayOfWeek} encoded in bits as if returned by {@link #getBits()}.
*/
private int convertDaysOfWeekToBits(final @DayOfWeek Integer... daysOfWeek) {
int bits = 0;
Expand All @@ -113,33 +114,34 @@ private int convertDaysOfWeekToBits(final @DayOfWeek Integer... daysOfWeek) {
}

/**
* Return {@code true} if the given day of the week is on, {@code false} otherwise.
*
* @param dayOfWeek Any of {@link DayOfWeek} values.
* @return {@code true} if the given day of the week is on, {@code false} otherwise.
*/
public boolean isBitOn(final @DayOfWeek int dayOfWeek) {
final int bit = DAYS_OF_WEEK_BITS[dayOfWeek];
return (mBits & bit) > 0;
}

/**
* @return The weekly repeat schedule encoded as an integer.
* Return the weekly repeat schedule encoded as an integer.
*/
public int getBits() { return mBits; }

/**
* @return {@code true} if at least one day of the week is enabled in the weekly repeat
* schedule, {@code false} otherwise.
* Return {@code true} if at least one day of the week is enabled in the weekly repeat schedule,
* {@code false} otherwise.
*/
public boolean isRepeating() { return mBits != 0; }

/**
* @return {@code true} if all days of the week are enabled in this weekly repeat schedule,
* Return {@code true} if all days of the week are enabled in this weekly repeat schedule,
* {@code false} otherwise.
*/
public boolean isFullWeek() { return mBits == ALL_DAYS_OF_WEEK_BITS; }

/**
* @return The total number of days of the week enabled in this weekly repeat schedule.
* Return the total number of days of the week enabled in this weekly repeat schedule.
*/
public int getCount() {
return (int) IntStream
Expand Down Expand Up @@ -236,7 +238,7 @@ public OptionalInt getDistanceToNextDayOfWeek(final @DayOfWeek int compareDayOfW
* Get the textual representation of a {@link DayOfWeek}, such as "Fri" or "Friday"
*
* @param dayOfWeek Any of {@link DayOfWeek} values.
* @param useLongNames If {@code true}, the un-abbreviated day of the week names are used, e.g.
* @param useLongName If {@code true}, the un-abbreviated day of the week names are used, e.g.
* Tuesday, Friday, Saturday, otherwise the abbreviated ones are used, e.g. Tue, Fri, Sat.
* @param locale The locale to use.
*/
Expand Down Expand Up @@ -319,8 +321,9 @@ public void remove() {
}

/**
* Extract the {@link DayOfWeek} value from a date-time object.
*
* @param ldt The date-time to get the corresponding {@link DayOfWeek} value from.
* @return A {@link DayOfWeek} value.
*/
public static @DayOfWeek int getDayOfWeekFrom(final @NonNull LocalDateTime ldt) {
return ldt.get(WeekFields.SUNDAY_START.dayOfWeek());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ public void syncAllSubscriptionsEnabledState(final @NonNull LocalDateTime compar
if (needSleep) {
try {
Thread.sleep(2_000);
} catch (InterruptedException ignored) { }
} catch (InterruptedException ignored) { /* @SuppressWarnings("EmptyCatch") */ }
}
}

Expand Down Expand Up @@ -405,7 +405,7 @@ private void doScheduleDatabaseRequest(final SubscriptionScheduleEntity schedule

mLogger.d("doScheduleDatabaseRequest(schedule=%s,opType=%s).", schedule, opType);

final LocalDateTime now = LocalDateTime.now();
final LocalDateTime now = LocalDateTime.now(ZoneId.systemDefault());
// We expect the schedules to take precedence over the user's preference when schedules
// are explicitly mutated by the user
final boolean overrideUserPreference = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ private RelativeDateTimeFormatter getRelativeFormatter(final Locale loc) {
final RelativeDateTimeFormatter.Style style = RelativeDateTimeFormatter.Style.SHORT;
final DisplayContext displayContext = DisplayContext.CAPITALIZATION_NONE;
mRelativeFormatter = RelativeDateTimeFormatter.getInstance(ULocale.forLocale(loc),
/*NumberFormat=*/ null, style, displayContext);
/*NumberFormat*/ null, style, displayContext);
mRelativeFormatterLocale = loc;
}
return mRelativeFormatter;
Expand Down
6 changes: 4 additions & 2 deletions src/com/github/iusmac/sevensim/telephony/PinStorage.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import dagger.Lazy;

import java.nio.charset.StandardCharsets;
import java.security.KeyStore;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
Expand Down Expand Up @@ -184,7 +185,7 @@ public boolean encrypt(final PinEntity pinEntity) {
try {
final Cipher cipher = Cipher.getInstance(AES_TRANSFORMATION);
cipher.init(Cipher.ENCRYPT_MODE, secretKey);
pinEntity.setData(cipher.doFinal(clearPin.getBytes()));
pinEntity.setData(cipher.doFinal(clearPin.getBytes(StandardCharsets.US_ASCII)));
pinEntity.setIV(cipher.getIV());
} catch (Exception e) {
mLogger.e("encrypt(pinEntity=%s) : %s", pinEntity, e);
Expand Down Expand Up @@ -228,7 +229,8 @@ public boolean decrypt(final @NonNull PinEntity pinEntity) {
final GCMParameterSpec spec = new GCMParameterSpec(GCM_PARAMETER_TAG_BIT_LEN,
pinEntity.getIV());
cipher.init(Cipher.DECRYPT_MODE, secretKey, spec);
pinEntity.setClearPin(new String(cipher.doFinal(pinEntity.getData())));
pinEntity.setClearPin(new String(cipher.doFinal(pinEntity.getData()),
StandardCharsets.US_ASCII));
} catch (Exception e) {
mLogger.e("decrypt(pinEntity=%s) : %s", pinEntity, e);
return false;
Expand Down
4 changes: 2 additions & 2 deletions src/com/github/iusmac/sevensim/telephony/Subscription.java
Original file line number Diff line number Diff line change
Expand Up @@ -195,14 +195,14 @@ public Subscription createFromParcel(final Parcel in) {
if (lastActivatedTime != null) {
sub.setLastActivatedTime(LocalDateTime.parse(lastActivatedTime));
}
} catch (DateTimeParseException ignored) {}
} catch (DateTimeParseException ignored) { /* @SuppressWarnings("EmptyCatch") */ }

try {
final String lastDeactivatedTime = in.readString();
if (lastDeactivatedTime != null) {
sub.setLastDeactivatedTime(LocalDateTime.parse(lastDeactivatedTime));
}
} catch (DateTimeParseException ignored) {}
} catch (DateTimeParseException ignored) { /* @SuppressWarnings("EmptyCatch") */ }

Optional.ofNullable(in.readString()).ifPresent((v) ->
sub.keepDisabledAcrossBoots(Boolean.parseBoolean(v)));
Expand Down
Loading

0 comments on commit 46f7f21

Please sign in to comment.