|
| 1 | +# Remove compatibility check |
| 2 | + |
| 3 | +At first start and once per day the application asks the Dexcom server for compatibility of the used device. The following modifications remove this behaviour from the application. |
| 4 | + |
| 5 | + |
| 6 | +## Disable compatibility webservice |
| 7 | + |
| 8 | +The file `/src/smali/com/android/databinding/library/baseAdapters/c.smali` implements the compatibility check. The function `performAppCompatibilityServerIO` initiates the request to the Dexcom server and looks somewhat like that: |
| 9 | + |
| 10 | +```java |
| 11 | +public class c implements b { |
| 12 | + |
| 13 | + // some code before... |
| 14 | + |
| 15 | + public void performAppCompatibilityServerIO(AppRuntimeInfo var1, String var2, com.dexcom.cgm.appcompatability.a var3) { |
| 16 | + this.m_validityResult = this.checkValidity(var1); |
| 17 | + if (!Objects.equals(this.m_validityResult.getMessageId(), "00000000-0000-0000-0000-000000000000")) { |
| 18 | + this.m_getMessageResult = this.getMessage(UUID.fromString(this.m_validityResult.getMessageId()), var2); |
| 19 | + } |
| 20 | + |
| 21 | + if (var3 != null) { |
| 22 | + var3.serverCallFinished(); |
| 23 | + } else { |
| 24 | + throw new IllegalArgumentException("AppCompatCompleteListener was null when server call was complete"); |
| 25 | + } |
| 26 | + } |
| 27 | + |
| 28 | + // some code after... |
| 29 | + |
| 30 | +} |
| 31 | +``` |
| 32 | + |
| 33 | +This modification removes the request and just returns a successful response: |
| 34 | + |
| 35 | +```java |
| 36 | +public class c implements b { |
| 37 | + |
| 38 | + // some code before... |
| 39 | + |
| 40 | + public void performAppCompatibilityServerIO(AppRuntimeInfo var1, String var2, com.dexcom.cgm.appcompatability.a var3) { |
| 41 | + this.m_validityResult = new ValidityResult(); |
| 42 | + this.m_validityResult.setValidity("ValidEnvironment"); |
| 43 | + this.m_validityResult.setMessageId("00000000-0000-0000-0000-000000000000"); |
| 44 | + if (var3 != null) { |
| 45 | + var3.serverCallFinished(); |
| 46 | + } else { |
| 47 | + throw new IllegalArgumentException("AppCompatCompleteListener was null when server call was complete"); |
| 48 | + } |
| 49 | + } |
| 50 | + |
| 51 | + // some code after... |
| 52 | + |
| 53 | +} |
| 54 | +``` |
| 55 | + |
| 56 | +The modification translated into smali code looks like this: |
| 57 | + |
| 58 | +```smali |
| 59 | +.method public performAppCompatibilityServerIO(Lcom/dexcom/cgm/model/AppRuntimeInfo;Ljava/lang/String;Lcom/dexcom/cgm/appcompatability/a;)V |
| 60 | + .locals 2 |
| 61 | +
|
| 62 | + new-instance v0, Lcom/dexcom/cgm/model/ValidityResult; |
| 63 | +
|
| 64 | + invoke-direct {v0}, Lcom/dexcom/cgm/model/ValidityResult;-><init>()V |
| 65 | +
|
| 66 | + iput-object v0, p0, Lcom/android/databinding/library/baseAdapters/c;->m_validityResult:Lcom/dexcom/cgm/model/ValidityResult; |
| 67 | +
|
| 68 | + iget-object v0, p0, Lcom/android/databinding/library/baseAdapters/c;->m_validityResult:Lcom/dexcom/cgm/model/ValidityResult; |
| 69 | +
|
| 70 | + const-string v1, "ValidEnvironment" |
| 71 | +
|
| 72 | + invoke-virtual {v0, v1}, Lcom/dexcom/cgm/model/ValidityResult;->setValidity(Ljava/lang/String;)V |
| 73 | +
|
| 74 | + iget-object v0, p0, Lcom/android/databinding/library/baseAdapters/c;->m_validityResult:Lcom/dexcom/cgm/model/ValidityResult; |
| 75 | +
|
| 76 | + const-string v1, "00000000-0000-0000-0000-000000000000" |
| 77 | +
|
| 78 | + invoke-virtual {v0, v1}, Lcom/dexcom/cgm/model/ValidityResult;->setMessageId(Ljava/lang/String;)V |
| 79 | +
|
| 80 | + if-eqz p3, :cond_0 |
| 81 | +
|
| 82 | + invoke-interface {p3}, Lcom/dexcom/cgm/appcompatability/a;->serverCallFinished()V |
| 83 | +
|
| 84 | + return-void |
| 85 | +
|
| 86 | + :cond_0 |
| 87 | + new-instance v0, Ljava/lang/IllegalArgumentException; |
| 88 | +
|
| 89 | + const-string v1, "AppCompatCompleteListener was null when server call was complete" |
| 90 | +
|
| 91 | + invoke-direct {v0, v1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V |
| 92 | +
|
| 93 | + throw v0 |
| 94 | +.end method |
| 95 | +``` |
| 96 | + |
| 97 | + |
| 98 | +## Redirect from compatibility view |
| 99 | + |
| 100 | +The file `/src/smali/com/dexcom/cgm/activities/AppCompatabilityActivity.smali` implements the compatibility screen. It shows an error message in case the Dexcom server denied compatibility for the device. |
| 101 | + |
| 102 | +The function `serverCallFinished` is executed after the application received a response from the Dexcom server. It looks somewhat like that: |
| 103 | + |
| 104 | +```java |
| 105 | +public class AppCompatabilityActivity extends DexBaseActivity implements OnAppInitListener, a { |
| 106 | + |
| 107 | + // some code before... |
| 108 | + |
| 109 | + public void serverCallFinished() { |
| 110 | + this.setNextCheckTimeToTomorrow(); |
| 111 | + if (Objects.equals(this.getAppCompatibilityService().getValidity().getMessageId(), "00000000-0000-0000-0000-000000000000")) { |
| 112 | + this.goDirectlyToNextActivity(); |
| 113 | + } else { |
| 114 | + this.m_validityResult = this.getAppCompatibilityService().getValidity(); |
| 115 | + this.m_getMessageResult = this.getAppCompatibilityService().getMessageResult(); |
| 116 | + this.processNewAppCompatability(); |
| 117 | + this.m_isFreshInstall = false; |
| 118 | + } |
| 119 | + } |
| 120 | + |
| 121 | + // some code after... |
| 122 | + |
| 123 | +} |
| 124 | +``` |
| 125 | + |
| 126 | +This modification ignores the response and redirects to the next view: |
| 127 | + |
| 128 | +```java |
| 129 | +public class AppCompatabilityActivity extends DexBaseActivity implements OnAppInitListener, a { |
| 130 | + |
| 131 | + // some code before... |
| 132 | + |
| 133 | + public void serverCallFinished() { |
| 134 | + this.setNextCheckTimeToTomorrow(); |
| 135 | + this.goDirectlyToNextActivity(); |
| 136 | + } |
| 137 | + |
| 138 | + // some code after... |
| 139 | + |
| 140 | +} |
| 141 | +``` |
| 142 | + |
| 143 | +The modification translated into smali code looks like this: |
| 144 | + |
| 145 | +```smali |
| 146 | +.method public serverCallFinished()V |
| 147 | + .locals 0 |
| 148 | +
|
| 149 | + invoke-direct {p0}, Lcom/dexcom/cgm/activities/AppCompatabilityActivity;->setNextCheckTimeToTomorrow()V |
| 150 | +
|
| 151 | + invoke-direct {p0}, Lcom/dexcom/cgm/activities/AppCompatabilityActivity;->goDirectlyToNextActivity()V |
| 152 | +
|
| 153 | + return-void |
| 154 | +.end method |
| 155 | +``` |
0 commit comments