Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prereqs for further development; a more thematic notification sound; improve the OPRs list #861

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

1fish2
Copy link
Contributor

@1fish2 1fish2 commented Mar 30, 2018

Summary:

  • Update to current tools (without changing targetApi yet): Android Studio 3.1, build tools 27.0.3, gradle 4.4, android gradle 3.1.0, current repositories, compileSDK 26, JDK 1.8, remove Retrolambda, Android gradle DSL updates, newer support libs.
  • Update to a more thematic notification sound It’s also higher pitch so it should be easier to hear from phone speakers.
  • Don't show OPRs before there are any match stats.

Issues Reference:

Test Plan:
It works on my phone.

Screenshots:
device-2018-03-29-222458

This is a prerequisite for updating to newer targetApi levels
and for averting Android Studio warnings about old stuff.

For Android Studio 3.1:
* build tools 27.0.3, gradle 4.4, android gradle 3.1.0
* repositories
* compileSDK 26, JDK 1.8
* Retrolambda is obsolete
* Android support libs. — Not yet guava, firebase, okhttp libs.
Build script changes needed for multidex, applicationVariants.all {},
“compile”, “apt”, … gradle DSL changes.
“flavors” are no longer needed for multiDexEnabled, which is
good because there are incompatible changes to the flavors
features. (build.workaround-missing-resource.gradle
concatenates flavor names for each variant. Hopefully this is
fine when there are no flavors.)

Presumably the updated libraries are backward-compatible.
This needs more testing.

Gradle sync still warns about obsolete/deprecated
configurations 'compile’, 'androidTestApi’, and 'androidTestCompile'
which will go away, but where are any
remaining uses of them?
It’s also higher pitch so it should be easier to hear from phone
speakers.
And fix O(N^2) code, even if N = 5.
@1fish2
Copy link
Contributor Author

1fish2 commented Mar 30, 2018

BTW, I just guessed at the updates for .travis.yml.

`./gradlew clean testDebugUnitTest` gets a lot of
`NoSuchMethodError: com.google.common.collect.ImmutableSet.copyOf()`
exceptions. I didn’t figure that out (multiple guavas on the
class path?) but debugging calls for more incremental steps.
This fixes some of the problems.

There are lots of errors `java.util.ServiceConfigurationError:
org.robolectric.internal.ShadowProvider: Provider
org.robolectric.shadows.support.v4.Shadows not a subtype`
which at least in part seems to be due to using a very old version of
Robolectric. Newer versions are compatible with later Android builds,
but they also have API changes. This particular error is supposedly
fixed in release 3.2, but trying to use that got a more basic error (let
alone upgrading to 3.8) that kept any tests from running:

```
DefaultTestRunner.java:26: error: constructor Implementation in class
Implementation cannot be applied to given types;
        return new Config.Implementation(
               ^
  required:
int[],int,int,String,String,String,String,String,String,String,Class<?>[
],String[],Class<? extends Application>,String[],Class<?>
  found:
int[],String,String,String,String,String,String,String,Class<?>[],String
[],Class<TestTbaAndroid>,String[],Class<CAP#1>
  reason: actual and formal argument lists differ in length
  where CAP#1 is a fresh type-variable:
    CAP#1 extends Object from capture of ?
```

Some of the gradle warnings come from

    apply plugin: 'com.facebook.testing.screenshot'

```
WARNING: Configuration 'androidTestCompile' is obsolete and has been
replaced with 'androidTestImplementation'.
It will be removed at the end of 2018
WARNING: Configuration 'androidTestApi' is obsolete and has been
replaced with 'androidTestImplementation'.
It will be removed at the end of 2018
The Task.leftShift(Closure) method has been deprecated and is scheduled
to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.
        at
build_f0nrmj106vzvtku1xoje7yb5h.run(/Users/jerry/dev/the-blue-alliance-a
ndroid/android/build.gradle:4)
        (Run with --stacktrace to get the full stack trace of this
deprecation warning.)
The ConfigurableReport.setDestination(Object) method has been
deprecated and is scheduled to be removed in Gradle 5.0. Please use the
method ConfigurableReport.setDestination(File) instead.
        at
code_coverage_4nvpfevghf39cb3c8tfyfobgg$_run_closure3$_closure4.doCall(/
Users/jerry/dev/the-blue-alliance-android/code_coverage.gradle:23)
        (Run with --stacktrace to get the full stack trace of this
deprecation warning.)
Version: 4.3.0-4+g26b71fb.dirty/4030000
WARNING: Configuration 'compile' is obsolete and has been replaced with
'implementation'.
It will be removed at the end of 2018
registerResGeneratingTask is deprecated, use
registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use
registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use
registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use
registerGeneratedResFolders(FileCollection)

The TaskInternal.execute() method has been deprecated and is scheduled
to be removed in Gradle 5.0. There are better ways to re-use task
logic, see
https://docs.gradle.org/4.4/userguide/custom_tasks.html#sec:reusing_task
_logic.
        at
build_workaround_missing_resou_f524m2091rtt3ispqncm4ndf4$_run_closure1$_
closure2.doCall(/Users/jerry/dev/the-blue-alliance-android/android/build
.workaround-missing-resource.gradle:32)
```
Group notification sounds stutter on Oreo, I think because it rate-
limits notifications so it starts the new notification then waits a
second before starting the group summary notification.

The fix requires the new
NotificationCompat.Builder#setGroupAlertBehavior method, so this
has to update to compileSdkVersion 26 and supportLibVersion 26.1.0.

The fix requires some code restructuring since the new method is on
NotificationCompat.Builder — no more modifying a built Notification
object. There’s more room for refactoring, e.g. set the builder’s title
and content text in one place.

This restructuring makes it easier to support API 26 notification
channels, but I didn’t add that in this commit. Can we do it w/o
targeting API 26?

(Forget the “easy fix” to the sound stutter. That one breaks the
expandable details of summary notifications.)

Update the vibration pattern to match the latest sound.

[Just to be sure, I re-imported the AndroidStyle.xml file that’s in the
project’s root directory. It still reordered imports.]

* Event Match Video notifications don’t appear in Recent
Notifications. Is that by design? Maybe the inherited getView()
method doesn’t work?
* Team Match Video notifications don’t appear in the notification shade
or Recent Notifications. Ditto on getView()?
@1fish2 1fish2 changed the title Prereqs for further development; a more thematic notification sound Prereqs for further development; a more thematic notification sound; improve the OPRs list Apr 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant