Skip to content

Commit

Permalink
Android/tv-casting-app: Fix for issue in finding handleInternal() on …
Browse files Browse the repository at this point in the history
…some Android phones (#165) (#26757)
  • Loading branch information
sharadb-amazon authored and pull[bot] committed May 24, 2024
1 parent 4764f4f commit 7582fad
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 5 deletions.
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

0 comments on commit 7582fad

Please sign in to comment.