@@ -114,8 +114,9 @@ public class VrShellDelegate
114
114
private static final String VR_CORE_MARKET_URI =
115
115
"market://details?id=" + VrCoreVersionChecker .VR_CORE_PACKAGE_ID ;
116
116
117
+ private static final String GVR_KEYBOARD_PACKAGE_ID = "com.google.android.vr.inputmethod" ;
117
118
private static final String GVR_KEYBOARD_MARKET_URI =
118
- "market://details?id=com.google.android.vr.inputmethod" ;
119
+ "market://details?id=" + GVR_KEYBOARD_PACKAGE_ID ;
119
120
120
121
// This value is intentionally probably overkill. This is the time we need to wait from when
121
122
// Chrome is resumed, to when Chrome actually renders a black frame, so that we can cancel the
@@ -136,6 +137,7 @@ public class VrShellDelegate
136
137
137
138
private @ VrSupportLevel int mVrSupportLevel ;
138
139
private int mCachedVrCorePackageVersion ;
140
+ private int mCachedGvrKeyboardPackageVersion ;
139
141
140
142
// How often to prompt the user to enter VR feedback.
141
143
private int mFeedbackFrequency ;
@@ -328,6 +330,7 @@ public static boolean onActivityResultWithNative(int requestCode, int resultCode
328
330
}
329
331
// Handles the result of requesting to update GVR Keyboard.
330
332
if (requestCode == GVR_KEYBOARD_UPDATE_RESULT ) {
333
+ if (sInstance != null ) sInstance .onGvrKeyboardMaybeUpdated ();
331
334
return true ;
332
335
}
333
336
return false ;
@@ -786,6 +789,11 @@ private int getVrCorePackageVersion() {
786
789
ContextUtils .getApplicationContext (), VrCoreVersionChecker .VR_CORE_PACKAGE_ID );
787
790
}
788
791
792
+ private int getGvrKeyboardPackageVersion () {
793
+ return PackageUtils .getPackageVersion (
794
+ ContextUtils .getApplicationContext (), GVR_KEYBOARD_PACKAGE_ID );
795
+ }
796
+
789
797
/**
790
798
* Updates mVrSupportLevel to the correct value. isVrCoreCompatible might return different value
791
799
* at runtime.
@@ -818,8 +826,12 @@ private void updateVrSupportLevel(Integer vrCorePackageVersion) {
818
826
}
819
827
820
828
private void onVrServicesMaybeUpdated () {
821
- int vrCorePackageVersion = getVrCorePackageVersion ();
822
- if (mCachedVrCorePackageVersion == vrCorePackageVersion ) return ;
829
+ if (mCachedVrCorePackageVersion == getVrCorePackageVersion ()) return ;
830
+ ApplicationLifetime .terminate (true );
831
+ }
832
+
833
+ private void onGvrKeyboardMaybeUpdated () {
834
+ if (mCachedGvrKeyboardPackageVersion == getGvrKeyboardPackageVersion ()) return ;
823
835
ApplicationLifetime .terminate (true );
824
836
}
825
837
@@ -1785,6 +1797,7 @@ public boolean onInfoBarButtonClicked(boolean isPrimary) {
1785
1797
}
1786
1798
1787
1799
/* package */ void promptForKeyboardUpdate () {
1800
+ mCachedGvrKeyboardPackageVersion = getGvrKeyboardPackageVersion ();
1788
1801
mActivity .startActivityForResult (
1789
1802
new Intent (Intent .ACTION_VIEW , Uri .parse (GVR_KEYBOARD_MARKET_URI )),
1790
1803
GVR_KEYBOARD_UPDATE_RESULT );
0 commit comments