Skip to content

Commit b031e69

Browse files
cmannett85-armbaldurk
authored andcommitted
Warn user if layer config application failed before JDWP failure
1 parent fa22eff commit b031e69

File tree

3 files changed

+22
-6
lines changed

3 files changed

+22
-6
lines changed

renderdoc/android/android.cpp

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1459,11 +1459,14 @@ ExecuteResult AndroidRemoteServer::ExecuteAndInject(const rdcstr &packageAndActi
14591459
{
14601460
info =
14611461
"Do you have a strange device that requires extra setup?\n"
1462-
"E.g. Xiaomi requires a developer account and \"USB debugging (Security Settings)\"\n";
1462+
"E.g. Xiaomi requires a developer account and \"USB debugging (Security Settings)\"";
14631463

14641464
RDCERR("Couldn't verify that debug settings are set:\n%s\n%s", inString.c_str(),
14651465
info.c_str());
14661466

1467+
result = RDResult(ResultCode::AndroidLayerConfFailed);
1468+
result.message = info;
1469+
14671470
hookWithJDWP = true;
14681471

14691472
// need to tell the hooks to ignore the fact that layers are present because they're not
@@ -1601,11 +1604,17 @@ ExecuteResult AndroidRemoteServer::ExecuteAndInject(const rdcstr &packageAndActi
16011604
{
16021605
RDCERR("Failed to inject using JDWP");
16031606
ident = 0;
1604-
result = RDResult(ResultCode::JDWPFailure);
1605-
result.message = StringFormat::Fmt(
1606-
"Failed to inject using JDWP when launching '%s' with activity '%s' and intent args "
1607-
"'%s'",
1608-
packageName.c_str(), activityName.c_str(), intentArgs.c_str());
1607+
1608+
// If layer configuration failed first, then report that to the user as it is usually easier
1609+
// to fix
1610+
if(result.code != ResultCode::AndroidLayerConfFailed)
1611+
{
1612+
result = RDResult(ResultCode::JDWPFailure);
1613+
result.message = StringFormat::Fmt(
1614+
"Failed to inject using JDWP when launching '%s' with activity '%s' and intent args "
1615+
"'%s'",
1616+
packageName.c_str(), activityName.c_str(), intentArgs.c_str());
1617+
}
16091618
return;
16101619
}
16111620
}

renderdoc/api/replay/renderdoc_tostr.inl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ rdcstr DoStringise(const ResultCode &el)
100100
STRINGISE_ENUM_CLASS_NAMED(InvalidParameter,
101101
"An invalid parameter was passed to RenderDoc's API");
102102
STRINGISE_ENUM_CLASS_NAMED(CompressionFailed, "Compression or decompression failed");
103+
STRINGISE_ENUM_CLASS_NAMED(AndroidLayerConfFailed,
104+
"Debug layer configuration failed on Android");
103105
}
104106
END_ENUM_STRINGISE();
105107
}

renderdoc/api/replay/replay_enums.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4216,6 +4216,10 @@ a remote server.
42164216
.. data:: CompressionFailed
42174217
42184218
Compression or decompression failed.
4219+
4220+
.. data:: AndroidLayerConfFailed
4221+
4222+
Debug layer configuration failed on Android.
42194223
)");
42204224
enum class ResultCode : uint32_t
42214225
{
@@ -4251,6 +4255,7 @@ enum class ResultCode : uint32_t
42514255
DataNotAvailable,
42524256
InvalidParameter,
42534257
CompressionFailed,
4258+
AndroidLayerConfFailed,
42544259
};
42554260

42564261
DECLARE_REFLECTION_ENUM(ResultCode);

0 commit comments

Comments
 (0)