Merge "Fix kotlin nullable errors in frameworks/base" into main
This commit is contained in:
@@ -137,14 +137,12 @@ class Quare(val width: Int, val height: Int, val depth: Int) : Parcelable {
|
||||
return 0
|
||||
}
|
||||
|
||||
override fun writeToParcel(p: Parcel?, flags: Int) {
|
||||
p?.let {
|
||||
p.writeInt(width)
|
||||
p.writeInt(height)
|
||||
p.writeInt(depth)
|
||||
p.writeIntArray(data)
|
||||
p.writeIntArray(user)
|
||||
}
|
||||
override fun writeToParcel(p: Parcel, flags: Int) {
|
||||
p.writeInt(width)
|
||||
p.writeInt(height)
|
||||
p.writeInt(depth)
|
||||
p.writeIntArray(data)
|
||||
p.writeIntArray(user)
|
||||
}
|
||||
|
||||
companion object CREATOR : Parcelable.Creator<Quare> {
|
||||
|
||||
@@ -60,8 +60,8 @@ class QuaresActivity : Activity() {
|
||||
|
||||
setContentView(R.layout.activity_quares)
|
||||
|
||||
grid = findViewById(R.id.grid)
|
||||
label = findViewById(R.id.label)
|
||||
grid = requireViewById(R.id.grid)
|
||||
label = requireViewById(R.id.label)
|
||||
|
||||
if (savedInstanceState != null) {
|
||||
Log.v(TAG, "restoring puzzle from state")
|
||||
@@ -135,7 +135,7 @@ class QuaresActivity : Activity() {
|
||||
if (q.check()) {
|
||||
val dp = resources.displayMetrics.density
|
||||
|
||||
val label: Button = findViewById(R.id.label)
|
||||
val label: Button = requireViewById(R.id.label)
|
||||
label.text = resName.replace(Regex("^.*/"), "")
|
||||
val drawable = icon?.loadDrawable(this)?.also {
|
||||
it.setBounds(0, 0, (32 * dp).toInt(), (32 * dp).toInt())
|
||||
|
||||
@@ -324,7 +324,7 @@ open class ThemedBatteryDrawable(private val context: Context, frameColor: Int)
|
||||
return batteryLevel
|
||||
}
|
||||
|
||||
override fun onBoundsChange(bounds: Rect?) {
|
||||
override fun onBoundsChange(bounds: Rect) {
|
||||
super.onBoundsChange(bounds)
|
||||
updateSize()
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ class PeerDeviceSystemAttestationVerificationTest {
|
||||
@Before
|
||||
fun setup() {
|
||||
rule.getScenario().onActivity {
|
||||
avm = it.getSystemService(AttestationVerificationManager::class.java)
|
||||
avm = it.getSystemService(AttestationVerificationManager::class.java)!!
|
||||
activity = it
|
||||
}
|
||||
invalidAttestationByteArray = TEST_ATTESTATION_CERT_FILENAME.fromPEMFileToByteArray()
|
||||
|
||||
@@ -43,7 +43,7 @@ class SystemAttestationVerificationTest {
|
||||
@Before
|
||||
fun setup() {
|
||||
rule.getScenario().onActivity {
|
||||
avm = it.getSystemService(AttestationVerificationManager::class.java)
|
||||
avm = it.getSystemService(AttestationVerificationManager::class.java)!!
|
||||
activity = it
|
||||
androidKeystore = KeyStore.getInstance(ANDROID_KEYSTORE).apply { load(null) }
|
||||
}
|
||||
|
||||
@@ -134,7 +134,7 @@ class AnrTest {
|
||||
private fun getExitReasons(): List<ApplicationExitInfo> {
|
||||
lateinit var infos: List<ApplicationExitInfo>
|
||||
instrumentation.runOnMainSync {
|
||||
val am = instrumentation.getContext().getSystemService(ActivityManager::class.java)
|
||||
val am = instrumentation.getContext().getSystemService(ActivityManager::class.java)!!
|
||||
infos = am.getHistoricalProcessExitReasons(PACKAGE_NAME, ALL_PIDS, NO_MAX)
|
||||
}
|
||||
return infos
|
||||
|
||||
@@ -47,6 +47,6 @@ class UnresponsiveGestureMonitorActivity : Activity() {
|
||||
super.onCreate(savedInstanceState)
|
||||
mInputMonitor = InputManager.getInstance().monitorGestureInput(MONITOR_NAME, displayId)
|
||||
mInputEventReceiver = UnresponsiveReceiver(
|
||||
mInputMonitor.getInputChannel(), Looper.myLooper())
|
||||
mInputMonitor.getInputChannel(), Looper.myLooper()!!)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -132,7 +132,7 @@ class BackgroundBlurActivity : Activity(), SeekBar.OnSeekBarChangeListener {
|
||||
mBlurForceDisabled = disabled
|
||||
Settings.Global.putInt(getContentResolver(), Settings.Global.DISABLE_WINDOW_BLURS,
|
||||
if (mBlurForceDisabled) 1 else 0)
|
||||
(findViewById(R.id.toggle_blur_enabled) as Button)
|
||||
(requireViewById(R.id.toggle_blur_enabled) as Button)
|
||||
.setText(if (mBlurForceDisabled) "Enable blurs" else "Disable blurs")
|
||||
}
|
||||
|
||||
@@ -142,13 +142,13 @@ class BackgroundBlurActivity : Activity(), SeekBar.OnSeekBarChangeListener {
|
||||
|
||||
fun setBackgroundBlur(radius: Int) {
|
||||
mBackgroundBlurRadius = radius
|
||||
(findViewById(R.id.background_blur_radius) as TextView).setText(radius.toString())
|
||||
(requireViewById(R.id.background_blur_radius) as TextView).setText(radius.toString())
|
||||
window.setBackgroundBlurRadius(mBackgroundBlurRadius)
|
||||
}
|
||||
|
||||
fun setBlurBehind(radius: Int) {
|
||||
mBlurBehindRadius = radius
|
||||
(findViewById(R.id.blur_behind_radius) as TextView).setText(radius.toString())
|
||||
(requireViewById(R.id.blur_behind_radius) as TextView).setText(radius.toString())
|
||||
window.getAttributes().setBlurBehindRadius(mBlurBehindRadius)
|
||||
window.setAttributes(window.getAttributes())
|
||||
}
|
||||
@@ -159,7 +159,7 @@ class BackgroundBlurActivity : Activity(), SeekBar.OnSeekBarChangeListener {
|
||||
} else {
|
||||
mDimAmountNoBlur = amount
|
||||
}
|
||||
(findViewById(R.id.dim_amount) as TextView).setText("%.2f".format(amount))
|
||||
(requireViewById(R.id.dim_amount) as TextView).setText("%.2f".format(amount))
|
||||
window.getAttributes().dimAmount = amount
|
||||
window.setAttributes(window.getAttributes())
|
||||
}
|
||||
@@ -168,7 +168,7 @@ class BackgroundBlurActivity : Activity(), SeekBar.OnSeekBarChangeListener {
|
||||
mBatterySavingModeOn = on
|
||||
Settings.Global.putInt(getContentResolver(),
|
||||
Settings.Global.LOW_POWER_MODE, if (on) 1 else 0)
|
||||
(findViewById(R.id.toggle_battery_saving_mode) as Button).setText(
|
||||
(requireViewById(R.id.toggle_battery_saving_mode) as Button).setText(
|
||||
if (on) "Exit low power mode" else "Enter low power mode")
|
||||
}
|
||||
|
||||
@@ -182,7 +182,7 @@ class BackgroundBlurActivity : Activity(), SeekBar.OnSeekBarChangeListener {
|
||||
} else {
|
||||
mAlphaNoBlur = alpha
|
||||
}
|
||||
(findViewById(R.id.background_alpha) as TextView).setText("%.2f".format(alpha))
|
||||
(requireViewById(R.id.background_alpha) as TextView).setText("%.2f".format(alpha))
|
||||
mBackgroundDrawable.setAlpha((alpha * 255f).toInt())
|
||||
getWindowManager().updateViewLayout(window.getDecorView(), window.getAttributes())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user