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

Android/tv-casting-app: Fix for issue in finding handleInternal() on some Android phones #26757

Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public abstract class FailureCallback {

public abstract void handle(MatterError err);

private final void handleInternal(int errorCode, String errorMessage) {
protected final void handleInternal(int errorCode, String errorMessage) {
try {
handle(new MatterError(errorCode, errorMessage));
} catch (Throwable t) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public abstract class MatterCallbackHandler {

public abstract void handle(MatterError err);

private final void handleInternal(int errorCode, String errorMessage) {
protected final void handleInternal(int errorCode, String errorMessage) {
try {
handle(new MatterError(errorCode, errorMessage));
} catch (Throwable t) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public abstract class SubscriptionEstablishedCallback {

public abstract void handle();

private void handleInternal() {
protected void handleInternal() {
try {
handle();
} catch (Throwable t) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public abstract class SuccessCallback<R> {

public abstract void handle(R response);

public void handleInternal(R response) {
protected final void handleInternal(R response) {
try {
handle(response);
} catch (Throwable t) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ CHIP_ERROR CallbackBaseJNI::SetUp(JNIEnv * env, jobject inHandler)
mClazz = env->GetObjectClass(mObject);
VerifyOrExit(mClazz != nullptr, ChipLogError(AppServer, "Failed to get handler Java class"));

mMethod = env->GetMethodID(mClazz, "handleInternal", mMethodSignature);
mSuperClazz = env->GetSuperclass(mClazz);
VerifyOrExit(mSuperClazz != nullptr, ChipLogError(AppServer, "Failed to get handler's parent's Java class"));

mMethod = env->GetMethodID(mSuperClazz, "handleInternal", mMethodSignature);
if (mMethod == nullptr)
{
ChipLogError(AppServer, "Failed to access 'handleInternal' method with signature %s", mMethodSignature);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class CallbackBaseJNI
protected:
jobject mObject = nullptr;
jclass mClazz = nullptr;
jclass mSuperClazz = nullptr;
jmethodID mMethod = nullptr;
const char * mMethodSignature = nullptr;
};
Expand Down