frameworks/native: merge commit '7d5047bc50..8cd7584f6d'

Signed-off-by: hmz007 <hmz007@gmail.com>
master
hmz007 7 months ago
parent f815d40eae
commit e26d821f07

@ -3491,6 +3491,21 @@ Dumpstate::RunStatus Dumpstate::RunInternal(int32_t calling_uid,
need_change_prio = false;
}
if (ds.options_->android_dump_demand || ds.options_->last_panic_dump) {
std::string destination = ds.CalledByApi()
? StringPrintf("[fd:%d]", ds.options_->bugreport_fd.get())
: ds.bugreport_internal_dir_.c_str();
long long int max_log_size = (long long int)android::base::GetIntProperty("dumpstate.max_log_size", 300);
if (max_log_size <= 0)
max_log_size = 300;
long long int total_size = GetDirectorySize((char *)destination.c_str());
MYLOGI("total_size (%lld), max log size is %lld\n", total_size, (max_log_size << 20));
if (total_size >= (max_log_size << 20)) {
DelEarliestTwoBugreport(destination);
total_size = GetDirectorySize((char *)destination.c_str());
}
}
if (options_->android_dump_demand) {
android_bugrepot_reason = android::base::GetProperty("sys.bugreport_reason", "unknown");
android_dropbox_time = android::base::GetProperty("sys.bugreport_time", "0");
@ -3770,22 +3785,6 @@ Dumpstate::RunStatus Dumpstate::RunInternal(int32_t calling_uid,
anr_data_.clear();
shutdown_checkpoints_.clear();
//----rk-change----
if (ds.options_->android_dump_demand || ds.options_->last_panic_dump) {
std::string destination = ds.CalledByApi()
? StringPrintf("[fd:%d]", ds.options_->bugreport_fd.get())
: ds.bugreport_internal_dir_.c_str();
long long int max_log_size = (long long int)android::base::GetIntProperty("dumpstate.max_log_size", 300);
if (max_log_size <= 0)
max_log_size = 300;
long long int total_size = GetDirectorySize((char *)destination.c_str());
MYLOGI("total_size (%lld), max log size is %lld\n", total_size, (max_log_size << 20));
if (total_size >= (max_log_size << 20)) {
DelEarliestTwoBugreport(destination);
total_size = GetDirectorySize((char *)destination.c_str());
}
}
//---------------
return (consent_callback_ != nullptr &&
consent_callback_->getResult() == UserConsentResult::UNAVAILABLE)
? USER_CONSENT_TIMED_OUT

@ -128,6 +128,7 @@ int main(int argc, char** argv) {
IPCThreadState::self()->disableBackgroundScheduling(true);
sp<ServiceManager> manager = sp<ServiceManager>::make(std::make_unique<Access>());
manager->setRequestingSid(true);
if (!manager->addService("manager", manager, false /*allowIsolated*/, IServiceManager::DUMP_FLAG_PRIORITY_DEFAULT).isOk()) {
LOG(ERROR) << "Could not self register servicemanager";
}

@ -65,6 +65,12 @@ rust_bindgen {
bindgen_flags: [
"--verbose",
"--allowlist-var=AMOTION_EVENT_FLAG_CANCELED",
//------rk add start------
"--allowlist-var=AMOTION_EVENT_FLAG_WINDOW_IS_OBSCURED",
"--allowlist-var=AMOTION_EVENT_FLAG_WINDOW_IS_PARTIALLY_OBSCURED",
"--allowlist-var=AMOTION_EVENT_FLAG_IS_ACCESSIBILITY_EVENT",
"--allowlist-var=AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE",
//------rk add end------
"--allowlist-var=AMOTION_EVENT_ACTION_CANCEL",
"--allowlist-var=AMOTION_EVENT_ACTION_UP",
"--allowlist-var=AMOTION_EVENT_ACTION_POINTER_DOWN",

@ -41,7 +41,9 @@ Result<void> InputVerifier::processMovement(int32_t deviceId, int32_t action, ui
rust::Slice<const RustPointerProperties> properties{rpp.data(), rpp.size()};
rust::String errorMessage =
android::input::verifier::process_movement(*mVerifier, deviceId, action, properties,
flags);
//------rk modiry start------
static_cast<uint32_t>(flags));
//------rk modiry end------
if (errorMessage.empty()) {
return {};
} else {

@ -49,7 +49,9 @@ mod ffi {
device_id: i32,
action: u32,
pointer_properties: &[RustPointerProperties],
flags: i32,
//------rk modify start------
flags: u32,
//------rk modify end------
) -> String;
}
@ -69,7 +71,9 @@ fn process_movement(
device_id: i32,
action: u32,
pointer_properties: &[RustPointerProperties],
flags: i32,
//------rk modify start------
flags: u32,
//------rk modify end------
) -> String {
let result = verifier.process_movement(
DeviceId(device_id),
@ -138,8 +142,20 @@ impl From<u32> for MotionAction {
}
bitflags! {
struct Flags: i32 {
const CANCELED = input_bindgen::AMOTION_EVENT_FLAG_CANCELED;
//------rk modify start------
struct Flags: u32 {
const CANCELED = input_bindgen::AMOTION_EVENT_FLAG_CANCELED as u32;
/// FLAG_WINDOW_IS_OBSCURED
const WINDOW_IS_OBSCURED = input_bindgen::AMOTION_EVENT_FLAG_WINDOW_IS_OBSCURED;
/// FLAG_WINDOW_IS_PARTIALLY_OBSCURED
const WINDOW_IS_PARTIALLY_OBSCURED =
input_bindgen::AMOTION_EVENT_FLAG_WINDOW_IS_PARTIALLY_OBSCURED;
/// FLAG_IS_ACCESSIBILITY_EVENT
const IS_ACCESSIBILITY_EVENT =
input_bindgen::AMOTION_EVENT_FLAG_IS_ACCESSIBILITY_EVENT;
/// FLAG_NO_FOCUS_CHANGE
const NO_FOCUS_CHANGE = input_bindgen::AMOTION_EVENT_FLAG_NO_FOCUS_CHANGE;
//------rk modify end------
}
}

@ -6204,9 +6204,7 @@ void InputDispatcher::doDispatchCycleFinishedCommand(nsecs_t finishTime,
bool restartEvent;
if (dispatchEntry->eventEntry->type == EventEntry::Type::KEY) {
KeyEntry& keyEntry = static_cast<KeyEntry&>(*(dispatchEntry->eventEntry));
restartEvent =
afterKeyEventLockedInterruptable(connection, dispatchEntry, keyEntry, handled);
restartEvent = afterKeyEventLockedInterruptable(connection, dispatchEntry, handled);
} else if (dispatchEntry->eventEntry->type == EventEntry::Type::MOTION) {
MotionEntry& motionEntry = static_cast<MotionEntry&>(*(dispatchEntry->eventEntry));
restartEvent = afterMotionEventLockedInterruptable(connection, dispatchEntry, motionEntry,
@ -6424,8 +6422,17 @@ void InputDispatcher::processConnectionResponsiveLocked(const Connection& connec
}
bool InputDispatcher::afterKeyEventLockedInterruptable(
const std::shared_ptr<Connection>& connection, DispatchEntry* dispatchEntry,
KeyEntry& keyEntry, bool handled) {
const std::shared_ptr<Connection>& connection, DispatchEntry* dispatchEntry, bool handled) {
// The dispatchEntry is currently valid, but it might point to a deleted object after we release
// the lock. For simplicity, make copies of the data of interest here and assume that
// 'dispatchEntry' is not valid after this section.
// Hold a strong reference to the EventEntry to ensure it's valid for the duration of this
// function, even if the DispatchEntry gets destroyed and releases its share of the ownership.
std::shared_ptr<EventEntry> eventEntry = dispatchEntry->eventEntry;
const bool hasForegroundTarget = dispatchEntry->hasForegroundTarget();
KeyEntry& keyEntry = static_cast<KeyEntry&>(*(eventEntry));
// To prevent misuse, ensure dispatchEntry is no longer valid.
dispatchEntry = nullptr;
if (keyEntry.flags & AKEY_EVENT_FLAG_FALLBACK) {
if (!handled) {
// Report the key as unhandled, since the fallback was not handled.
@ -6442,7 +6449,7 @@ bool InputDispatcher::afterKeyEventLockedInterruptable(
connection->inputState.removeFallbackKey(originalKeyCode);
}
if (handled || !dispatchEntry->hasForegroundTarget()) {
if (handled || !hasForegroundTarget) {
// If the application handles the original key for which we previously
// generated a fallback or if the window is not a foreground window,
// then cancel the associated fallback key, if any.

@ -685,8 +685,8 @@ private:
REQUIRES(mLock);
std::map<int32_t /*displayId*/, InputVerifier> mVerifiersByDisplay;
bool afterKeyEventLockedInterruptable(const std::shared_ptr<Connection>& connection,
DispatchEntry* dispatchEntry, KeyEntry& keyEntry,
bool handled) REQUIRES(mLock);
DispatchEntry* dispatchEntry, bool handled)
REQUIRES(mLock);
bool afterMotionEventLockedInterruptable(const std::shared_ptr<Connection>& connection,
DispatchEntry* dispatchEntry, MotionEntry& motionEntry,
bool handled) REQUIRES(mLock);

@ -182,12 +182,20 @@ FloatRect OutputLayer::calculateOutputSourceCrop(uint32_t internalDisplayRotatio
}
//RK code
// Fix White line in case that layer is mixed GPU and HW composite.
//
// In scenarios where the decimal part of certain rect values is 0.5,
// using the rounding method might result in inconsistencies where the GPU's internal calculations do not round up,
// while the CPU calculations do round up.
// Change to +0.499 than clip will better align between GPU and CPU result
// redmine: #547677 #540271
static Rect ClipFloatRect2Rect(FloatRect rectf){
Rect r;
r.left = static_cast<int32_t>(rectf.left);
r.top = static_cast<int32_t>(rectf.top);
r.right = static_cast<int32_t>(rectf.right);
r.bottom = static_cast<int32_t>(rectf.bottom);
r.left = static_cast<int32_t>(rectf.left+0.499);
r.top = static_cast<int32_t>(rectf.top+0.499);
r.right = static_cast<int32_t>(rectf.right+0.499);
r.bottom = static_cast<int32_t>(rectf.bottom+0.499);
return r;
}
//RK code

@ -2936,7 +2936,18 @@ void Layer::onLayerDisplayed(ftl::SharedFuture<FenceResult> futureFenceResult,
ch->previousReleaseFences.emplace_back(std::move(futureFenceResult));
ch->name = mName;
}
mPreviouslyPresentedLayerStacks.push_back(layerStack);
//RK_code bgein---
bool found_layer_stack = false;
for(auto &old_stack: mPreviouslyPresentedLayerStacks){
if(layerStack == old_stack){
found_layer_stack = true;
break;
}
}
if(!found_layer_stack){
mPreviouslyPresentedLayerStacks.push_back(layerStack);
}
//RK_code end---
}
void Layer::onSurfaceFrameCreated(

@ -935,6 +935,19 @@ void SurfaceFlinger::init() FTL_FAKE_GUARD(kMainThreadContext) {
});
}
//-------rk-code-begin-----
// Check hotplug events after scheduler init, so no event will be missed.
bool isHotplugPending = false;
{
std::lock_guard<std::mutex> lock(mHotplugMutex);
isHotplugPending = mPendingHotplugEvents.size()>0;
}
if(mScheduler && isHotplugPending){
mScheduler->scheduleConfigure();
}
//-------rk-code-end-----
ALOGV("Done initializing");
}

Loading…
Cancel
Save