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

Fix/pull header #4119

Merged
merged 4 commits into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions framework/android/connector/dom/src/main/cpp/src/dom_jni.cc
Original file line number Diff line number Diff line change
Expand Up @@ -163,18 +163,16 @@ jint CreateDomManager(JNIEnv* j_env, jobject j_obj, jint j_group_id, jint j_shar
if (share_dom_id > 0) {
flag = hippy::global_data_holder.Find(static_cast<uint32_t>(share_dom_id), share_dom_manager);
}
FOOTSTONE_DLOG(ERROR) << "CreateDomManager flag " << flag << ", dom_id " << dom_id << ", share_dom_id " << share_dom_id;
FOOTSTONE_DLOG(INFO) << "CreateDomManager flag " << flag << ", dom_id " << dom_id<< ", share_dom_id " << share_dom_id << ", group_id " << group_id;
if (flag && group_id != kDefaultGroupId) {
FOOTSTONE_DLOG(ERROR) << "CreateDomManager share ";
auto dom_manager_object = std::any_cast<std::shared_ptr<DomManager>>(share_dom_manager);
auto worker = dom_manager_object->GetWorker();
auto runner = dom_manager_object->GetTaskRunner();
dom_manager->SetTaskRunner(runner);
dom_manager->SetWorker(worker);
auto count = worker->FetchAndAddReuseCount();
FOOTSTONE_DLOG(ERROR) << "CreateDomManager worker reuse count " << count << ", dom manager id " << dom_id;
FOOTSTONE_DLOG(INFO) << "CreateDomManager worker reuse count " << count << ", dom manager id " << dom_id;
} else {
FOOTSTONE_DLOG(ERROR) << "CreateDomManager create new ";
auto worker = std::make_shared<WorkerImpl>(kDomWorkerName, false);
auto callback = std::make_shared<JavaRef>(j_env, j_obj);
worker->BeforeStart([callback]() {
Expand Down
1 change: 1 addition & 0 deletions modules/android/serialization/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,5 @@ android {

dependencies {
implementation deps.annotation
implementation project(':hippy-support')
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package com.tencent.mtt.hippy.serialization.nio.writer;

import com.tencent.mtt.hippy.utils.LogUtils;
import java.nio.ByteBuffer;

@SuppressWarnings({"unused"})
Expand Down Expand Up @@ -73,22 +74,38 @@ public void putDouble(double d) {
}

@SuppressWarnings("SpellCheckingInspection")
// After upgrading to AGP version 8 or above, R8 compilation will be started. Due to the optimization
// of R8 compilation code, it will affect the logic of the code here, causing encoding and decoding
// failures and white screen problems. Therefore, it is necessary to add some logs in the implementation
// of this function to avoid R8 compilation optimization.
@Override
public int putVarint(long l) {
if (count + 10 > value.length) {
enlargeBuffer(count + 10);
}

if (LogUtils.isDebugMode()) {
LogUtils.d("CallFunction", "putVarint l " + l + ", count " + count);
}
long rest = l;
int bytes = 0;
byte b;
do {
b = (byte) rest;
if (LogUtils.isDebugMode()) {
LogUtils.d("CallFunction", "putVarint origin b " + b + ", count " + count);
}
b |= 0x80;
if (LogUtils.isDebugMode()) {
LogUtils.d("CallFunction", "putVarint b " + Byte.toUnsignedInt(b) + ", count " + count);
}
value[count++] = b;
rest >>>= 7;
bytes++;
} while (rest != 0);
if (LogUtils.isDebugMode()) {
LogUtils.d("CallFunction",
"putVarint bb " + Byte.toUnsignedInt((byte) (b & 0x7f)) + ", bytes " + bytes + ", count " + count);
}
value[count - 1] = (byte) (b & 0x7f);
return bytes;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import com.tencent.mtt.hippy.annotation.HippyController;
import com.tencent.mtt.hippy.common.HippyArray;
import com.tencent.mtt.hippy.uimanager.ControllerManager;
import com.tencent.mtt.hippy.uimanager.ControllerRegistry;
import com.tencent.mtt.hippy.uimanager.HippyViewController;
import com.tencent.renderer.node.PullHeaderRenderNode;
import com.tencent.renderer.node.RenderNode;
Expand Down Expand Up @@ -102,6 +103,26 @@ public void run() {
}
}


@Override
public void updateLayout(int rootId, int id, int x, int y, int width, int height,
ControllerRegistry componentHolder) {
super.updateLayout(rootId, id, x, y, width, height, componentHolder);
View view = componentHolder.getView(rootId, id);
if (view instanceof HippyPullHeaderView && view.getParent() instanceof ViewGroup) {
int w = view.getWidth();
int h = view.getHeight();
ViewGroup.LayoutParams lp = view.getLayoutParams();
if (lp != null) {
LogUtils.d(TAG, "updateLayout: id " + id + ", w " + w + ", h " + h
+ ", width " + width + ", height " + height + ", lp.width " + lp.width + ", lp.height "
+ lp.height);
lp.width = width;
lp.height = height;
}
}
}

@Override
public void dispatchFunction(@NonNull HippyPullHeaderView pullHeaderView,
@NonNull String functionName, @NonNull HippyArray params) {
Expand Down
Loading