Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

Commit

Permalink
Try #12955:
Browse files Browse the repository at this point in the history
  • Loading branch information
MozLando committed Oct 19, 2022
2 parents bb4f4bd + 572f21c commit 65fa092
Show file tree
Hide file tree
Showing 7 changed files with 95 additions and 6 deletions.
6 changes: 6 additions & 0 deletions components/support/ktx/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ dependencies {
testImplementation Dependencies.testing_coroutines
testImplementation Dependencies.testing_robolectric
testImplementation Dependencies.testing_mockito

androidTestImplementation project(':support-android-test')
androidTestImplementation Dependencies.androidx_test_core
androidTestImplementation Dependencies.androidx_test_runner
androidTestImplementation Dependencies.androidx_test_rules
androidTestImplementation Dependencies.androidx_test_junit
}

apply from: '../../../publish.gradle'
Expand Down
13 changes: 13 additions & 0 deletions components/support/ktx/src/androidTest/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="mozilla.components.support.ktx">

<application>
<activity
android:name=".TestActivity"
android:exported="false" />
</application>

</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

package mozilla.components.support.ktx

import android.app.Activity

/**
* Empty activity only to be used in UI tests.
*/
internal class TestActivity : Activity()
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

package mozilla.components.support.ktx.android.view

import android.graphics.Color
import androidx.test.ext.junit.rules.ActivityScenarioRule
import mozilla.components.support.ktx.TestActivity
import org.junit.Assert.assertFalse
import org.junit.Assert.assertTrue
import org.junit.Rule
import org.junit.Test

class WindowKtTest {
@get:Rule
internal val activityRule: ActivityScenarioRule<TestActivity> = ActivityScenarioRule(TestActivity::class.java)

@Test
fun whenALightColorIsAppliedToStatusBarThenSetIsAppearanceLightStatusBarsToTrue() {
activityRule.scenario.onActivity {
it.window.setStatusBarTheme(Color.WHITE)

assertTrue(it.window.getWindowInsetsController().isAppearanceLightStatusBars)
}
}

@Test
fun whenADarkColorIsAppliedToStatusBarThenSetIsAppearanceLightStatusBarsToFalse() {
activityRule.scenario.onActivity {
it.window.setStatusBarTheme(Color.BLACK)

assertFalse(it.window.getWindowInsetsController().isAppearanceLightStatusBars)
}
}

@Test
fun whenALightColorIsAppliedToNavigationBarThemeThenSetIsAppearanceLightNavigationBarsToTrue() {
activityRule.scenario.onActivity {
it.window.setNavigationBarTheme(Color.WHITE)

assertTrue(it.window.getWindowInsetsController().isAppearanceLightNavigationBars)
}
}

@Test
fun whenADarkColorIsAppliedToNavigationBarThemeThenSetIsAppearanceLightNavigationBarsToFalse() {
activityRule.scenario.onActivity {
it.window.setNavigationBarTheme(Color.BLACK)

assertFalse(it.window.getWindowInsetsController().isAppearanceLightNavigationBars)
}
}
}
1 change: 1 addition & 0 deletions components/support/ktx/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,24 @@ import mozilla.components.support.utils.ColorUtils.isDark
* Colors the status bar.
* If the color is light enough, a light status bar with dark icons will be used.
*/
fun Window.setStatusBarTheme(@ColorInt color: Int) {
fun Window.setStatusBarTheme(@ColorInt toolbarColor: Int) {
getWindowInsetsController().isAppearanceLightStatusBars =
isDark(color)
statusBarColor = color
!isDark(toolbarColor)
statusBarColor = toolbarColor
}

/**
* Colors the navigation bar.
* If the color is light enough, a light navigation bar with dark icons will be used.
*/
fun Window.setNavigationBarTheme(@ColorInt color: Int) {
fun Window.setNavigationBarTheme(@ColorInt toolbarColor: Int) {
getWindowInsetsController().isAppearanceLightNavigationBars =
isDark(color)
!isDark(toolbarColor)

if (SDK_INT >= Build.VERSION_CODES.P) {
navigationBarDividerColor = 0
}
navigationBarColor = color
navigationBarColor = toolbarColor
}

/**
Expand Down
3 changes: 3 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ permalink: /changelog/
* **feature-qr**
* QRFeature now allows querying if scanning is in progress with a new `isScanInProgress` property. This helps deciding on whether to resume scanning by calling `scan` in a new `QRFeature` instance as it can happen if the process is restarted as a followup to the user updating system permissions for the app.

* **support-ktx**:
* The colors of the icons from the status bar should be in contrast with the status bar background color [#1795650](https://bugzilla.mozilla.org/show_bug.cgi?id=1795650)

# 107.0.0
* [Commits](https://github.com/mozilla-mobile/android-components/compare/v106.0.0..v107.0.0)
* [Milestone](https://github.com/mozilla-mobile/android-components/milestone/154?closed=1)
Expand Down

6 comments on commit 65fa092

@firefoxci-taskcluster
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uh oh! Looks like an error! Details

Client ID static/taskcluster/github does not have sufficient scopes and is missing the following scopes:

{
  "AnyOf": [
    "queue:rerun-task:mobile-level-3/O9tGtkH-SCuwAR48YNHNnA/LwizZCVPTgmuifdo0JmjKw",
    "queue:rerun-task-in-project:none",
    {
      "AllOf": [
        "queue:rerun-task",
        "assume:scheduler-id:mobile-level-3/O9tGtkH-SCuwAR48YNHNnA"
      ]
    }
  ]
}

This request requires the client to satisfy the following scope expression:

{
  "AnyOf": [
    "queue:rerun-task:mobile-level-3/O9tGtkH-SCuwAR48YNHNnA/LwizZCVPTgmuifdo0JmjKw",
    "queue:rerun-task-in-project:none",
    {
      "AllOf": [
        "queue:rerun-task",
        "assume:scheduler-id:mobile-level-3/O9tGtkH-SCuwAR48YNHNnA"
      ]
    }
  ]
}

  • method: rerunTask
  • errorCode: InsufficientScopes
  • statusCode: 403
  • time: 2022-10-19T12:26:42.641Z

@firefoxci-taskcluster
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uh oh! Looks like an error! Details

Client ID static/taskcluster/github does not have sufficient scopes and is missing the following scopes:

{
  "AnyOf": [
    "queue:rerun-task:mobile-level-3/O9tGtkH-SCuwAR48YNHNnA/LwizZCVPTgmuifdo0JmjKw",
    "queue:rerun-task-in-project:none",
    {
      "AllOf": [
        "queue:rerun-task",
        "assume:scheduler-id:mobile-level-3/O9tGtkH-SCuwAR48YNHNnA"
      ]
    }
  ]
}

This request requires the client to satisfy the following scope expression:

{
  "AnyOf": [
    "queue:rerun-task:mobile-level-3/O9tGtkH-SCuwAR48YNHNnA/LwizZCVPTgmuifdo0JmjKw",
    "queue:rerun-task-in-project:none",
    {
      "AllOf": [
        "queue:rerun-task",
        "assume:scheduler-id:mobile-level-3/O9tGtkH-SCuwAR48YNHNnA"
      ]
    }
  ]
}

  • method: rerunTask
  • errorCode: InsufficientScopes
  • statusCode: 403
  • time: 2022-10-19T12:26:45.722Z

@firefoxci-taskcluster
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uh oh! Looks like an error! Details

Client ID static/taskcluster/github does not have sufficient scopes and is missing the following scopes:

{
  "AnyOf": [
    "queue:rerun-task:mobile-level-3/O9tGtkH-SCuwAR48YNHNnA/P-Qw62HPRZGd7rzXMVzpow",
    "queue:rerun-task-in-project:none",
    {
      "AllOf": [
        "queue:rerun-task",
        "assume:scheduler-id:mobile-level-3/O9tGtkH-SCuwAR48YNHNnA"
      ]
    }
  ]
}

This request requires the client to satisfy the following scope expression:

{
  "AnyOf": [
    "queue:rerun-task:mobile-level-3/O9tGtkH-SCuwAR48YNHNnA/P-Qw62HPRZGd7rzXMVzpow",
    "queue:rerun-task-in-project:none",
    {
      "AllOf": [
        "queue:rerun-task",
        "assume:scheduler-id:mobile-level-3/O9tGtkH-SCuwAR48YNHNnA"
      ]
    }
  ]
}

  • method: rerunTask
  • errorCode: InsufficientScopes
  • statusCode: 403
  • time: 2022-10-19T12:27:52.091Z

@firefoxci-taskcluster
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uh oh! Looks like an error! Details

Client ID static/taskcluster/github does not have sufficient scopes and is missing the following scopes:

{
  "AnyOf": [
    "queue:rerun-task:mobile-level-3/O9tGtkH-SCuwAR48YNHNnA/LwizZCVPTgmuifdo0JmjKw",
    "queue:rerun-task-in-project:none",
    {
      "AllOf": [
        "queue:rerun-task",
        "assume:scheduler-id:mobile-level-3/O9tGtkH-SCuwAR48YNHNnA"
      ]
    }
  ]
}

This request requires the client to satisfy the following scope expression:

{
  "AnyOf": [
    "queue:rerun-task:mobile-level-3/O9tGtkH-SCuwAR48YNHNnA/LwizZCVPTgmuifdo0JmjKw",
    "queue:rerun-task-in-project:none",
    {
      "AllOf": [
        "queue:rerun-task",
        "assume:scheduler-id:mobile-level-3/O9tGtkH-SCuwAR48YNHNnA"
      ]
    }
  ]
}

  • method: rerunTask
  • errorCode: InsufficientScopes
  • statusCode: 403
  • time: 2022-10-19T12:29:09.829Z

@firefoxci-taskcluster
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uh oh! Looks like an error! Details

Client ID static/taskcluster/github does not have sufficient scopes and is missing the following scopes:

{
  "AnyOf": [
    "queue:rerun-task:mobile-level-3/O9tGtkH-SCuwAR48YNHNnA/LwizZCVPTgmuifdo0JmjKw",
    "queue:rerun-task-in-project:none",
    {
      "AllOf": [
        "queue:rerun-task",
        "assume:scheduler-id:mobile-level-3/O9tGtkH-SCuwAR48YNHNnA"
      ]
    }
  ]
}

This request requires the client to satisfy the following scope expression:

{
  "AnyOf": [
    "queue:rerun-task:mobile-level-3/O9tGtkH-SCuwAR48YNHNnA/LwizZCVPTgmuifdo0JmjKw",
    "queue:rerun-task-in-project:none",
    {
      "AllOf": [
        "queue:rerun-task",
        "assume:scheduler-id:mobile-level-3/O9tGtkH-SCuwAR48YNHNnA"
      ]
    }
  ]
}

  • method: rerunTask
  • errorCode: InsufficientScopes
  • statusCode: 403
  • time: 2022-10-19T12:32:35.247Z

@firefoxci-taskcluster
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uh oh! Looks like an error! Details

Client ID static/taskcluster/github does not have sufficient scopes and is missing the following scopes:

{
  "AnyOf": [
    "queue:rerun-task:mobile-level-3/O9tGtkH-SCuwAR48YNHNnA/P-Qw62HPRZGd7rzXMVzpow",
    "queue:rerun-task-in-project:none",
    {
      "AllOf": [
        "queue:rerun-task",
        "assume:scheduler-id:mobile-level-3/O9tGtkH-SCuwAR48YNHNnA"
      ]
    }
  ]
}

This request requires the client to satisfy the following scope expression:

{
  "AnyOf": [
    "queue:rerun-task:mobile-level-3/O9tGtkH-SCuwAR48YNHNnA/P-Qw62HPRZGd7rzXMVzpow",
    "queue:rerun-task-in-project:none",
    {
      "AllOf": [
        "queue:rerun-task",
        "assume:scheduler-id:mobile-level-3/O9tGtkH-SCuwAR48YNHNnA"
      ]
    }
  ]
}

  • method: rerunTask
  • errorCode: InsufficientScopes
  • statusCode: 403
  • time: 2022-10-19T12:33:49.048Z

Please sign in to comment.