Snap for 9591832 from dd1ae5dd28 to udc-release

Change-Id: Ic243ca3b774042a2f7a8b912862928985b1d7e8d
This commit is contained in:
Android Build Coastguard Worker 2023-02-11 06:07:48 +00:00
commit 8a89a3549a
7 changed files with 66 additions and 0 deletions

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
* Copyright (c) 2023, The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<resources>
<!-- Auth credential PIN/PATTERN/PASSWORD -->
<dimen name="biometric_auth_pattern_view_size">248dp</dimen>
<dimen name="biometric_auth_pattern_view_max_size">348dp</dimen>
</resources>

View file

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2023 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="AuthCredentialPatternContainerStyle">
<item name="android:gravity">center</item>
<item name="android:maxHeight">@dimen/biometric_auth_pattern_view_max_size</item>
<item name="android:maxWidth">@dimen/biometric_auth_pattern_view_max_size</item>
<item name="android:minHeight">@dimen/biometric_auth_pattern_view_size</item>
<item name="android:minWidth">@dimen/biometric_auth_pattern_view_size</item>
<item name="android:paddingVertical">40dp</item>
</style>
</resources>

View file

@ -23,4 +23,8 @@
<!-- Location on the screen of the center of the physical fingerprint sensor -->
<dimen name="physical_fingerprint_sensor_center_screen_location_x">2208px</dimen>
<!-- Lock pattern view size, align sysui biometric_auth_pattern_view_size -->
<dimen name="biometric_auth_pattern_view_size">298dp</dimen>
<dimen name="biometric_auth_pattern_view_max_size">348dp</dimen>
</resources>

View file

@ -529,6 +529,7 @@ Vibrator::Vibrator(std::unique_ptr<HwApi> hwApiDefault, std::unique_ptr<HwCal> h
mSupportedPrimitives = defaultSupportedPrimitives;
}
mPrimitiveMaxScale = {1.0f, 0.95f, 0.75f, 0.9f, 1.0f, 1.0f, 1.0f, 0.75f, 0.75f};
mPrimitiveMinScale = {0.0f, 0.01f, 0.11f, 0.23f, 0.0f, 0.25f, 0.02f, 0.03f, 0.16f};
// ====== Get GPIO status and init it ================
@ -771,6 +772,11 @@ ndk::ScopedAStatus Vibrator::compose(const std::vector<CompositeEffect> &composi
if (!status.isOk()) {
return status;
}
// Add a max and min threshold to prevent the device crash(overcurrent) or no
// feeling
if (effectScale > mPrimitiveMaxScale[static_cast<uint32_t>(e_curr.primitive)]) {
effectScale = mPrimitiveMaxScale[static_cast<uint32_t>(e_curr.primitive)];
}
if (effectScale < mPrimitiveMinScale[static_cast<uint32_t>(e_curr.primitive)]) {
effectScale = mPrimitiveMinScale[static_cast<uint32_t>(e_curr.primitive)];
}
@ -1444,6 +1450,10 @@ ndk::ScopedAStatus Vibrator::getSimpleDetails(Effect effect, EffectStrength stre
case Effect::HEAVY_CLICK:
effectIndex = WAVEFORM_CLICK_INDEX;
intensity *= 1.0f;
// WAVEFORM_CLICK_INDEX is 2, but the primitive CLICK index is 1.
if (intensity > mPrimitiveMaxScale[WAVEFORM_CLICK_INDEX - 1]) {
intensity = mPrimitiveMaxScale[WAVEFORM_CLICK_INDEX - 1];
}
break;
default:
return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);

View file

@ -231,6 +231,7 @@ class Vibrator : public BnVibrator {
bool mIsChirpEnabled;
uint32_t mSupportedPrimitivesBits = 0x0;
std::vector<CompositePrimitive> mSupportedPrimitives;
std::vector<float> mPrimitiveMaxScale;
std::vector<float> mPrimitiveMinScale;
bool mConfigHapticAlsaDeviceDone{false};
bool mGPIOStatus;