From dc9790578686e9b5b4d8fa8e66c42593825caeaf Mon Sep 17 00:00:00 2001 From: Aaron Huang Date: Thu, 16 Feb 2023 14:26:48 +0800 Subject: [PATCH] Add isMatchRuleMobile back There's a user still call this method which causes the app crash and it might be the app was built against hidden API. The bug was observed after updating the mainline module so adding this method back to the module to avoid apps crash due to the method is not found in NetworkTemplate. Bug: 269178029 Test: build Change-Id: I06dc694b1ce060488135f5d34138f14abd50ad32 --- framework-t/src/android/net/NetworkTemplate.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/framework-t/src/android/net/NetworkTemplate.java b/framework-t/src/android/net/NetworkTemplate.java index 748b1bab2a..c0e0449570 100644 --- a/framework-t/src/android/net/NetworkTemplate.java +++ b/framework-t/src/android/net/NetworkTemplate.java @@ -404,6 +404,19 @@ public final class NetworkTemplate implements Parcelable { return false; } + // TODO(b/270089918): Remove this method after no callers. + /** @hide */ + public boolean isMatchRuleMobile() { + switch (mMatchRule) { + case MATCH_MOBILE: + // Old MATCH_MOBILE_WILDCARD + case 6: + return true; + default: + return false; + } + } + /** * Get match rule of the template. See {@code MATCH_*}. */