Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App crashing due to theming issue when trying to calling ApprovedKeyboardsDialogHelper.showKeyboardInstallDialog #142

Open
daniel-m-dd opened this issue Dec 19, 2022 · 5 comments
Labels
Bug Under Investigation The issue is currently being investigated by the product team.

Comments

@daniel-m-dd
Copy link

daniel-m-dd commented Dec 19, 2022

Hello I am encountering this crash when integrating and testing the MS intune SDK. Thanks!

Describe the bug:

App with the Intune SDK included is crashing when trying to show the Intune keyboard dialog.

android.view.InflateException: Binary XML file line #80 in android:layout/alert_dialog_material: Binary XML file line #37 in android:layout/alert_dialog_button_bar_material: Error inflating class Button
Caused by: android.view.InflateException: Binary XML file line #37 in android:layout/alert_dialog_button_bar_material: Error inflating class Button
Caused by: java.lang.IllegalArgumentException: The style on this component requires your app theme to be Theme.AppCompat (or a descendant).

I did check that my app is correctly using a Theme.AppCompat (more precisely we are using MaterialTheme) and could also a dialog when calling/building the dialog manually. Besides I do get other dialogs working correctly. Example: when restricting the allowed browser to Edge; the dialog asking to download Edge is correctly shown.

My guess is the Intune wrapper is somewhere using the application context instead of the activity context when building the dialog.

To Reproduce
Steps to reproduce the behavior:

  1. Create a policy not allowing any keyboard installed on your device
  2. Open your app with the ms-intne sdk integrated and try to search/type something in a androidx.appcompat.widget.SearchView view
  3. See crash

Expected behavior:
Should not crash and show the appropriate ms intune helper dialog

Screenshots and logs:

Stacktrace:

                   
Process: myapp.package.name, PID: 27544
android.view.InflateException: Binary XML file line #80 in android:layout/alert_dialog_material: Binary XML file line #37 in android:layout/alert_dialog_button_bar_material: Error inflating class Button
Caused by: android.view.InflateException: Binary XML file line #37 in android:layout/alert_dialog_button_bar_material: Error inflating class Button
Caused by: java.lang.IllegalArgumentException: The style on this component requires your app theme to be Theme.AppCompat (or a descendant).
	at com.google.android.material.internal.ThemeEnforcement.checkTheme(ThemeEnforcement.java:241)
	at com.google.android.material.internal.ThemeEnforcement.checkAppCompatTheme(ThemeEnforcement.java:211)
	at com.google.android.material.internal.ThemeEnforcement.checkCompatibleTheme(ThemeEnforcement.java:146)
	at com.google.android.material.internal.ThemeEnforcement.obtainStyledAttributes(ThemeEnforcement.java:75)
	at com.google.android.material.button.MaterialButton.<init>(MaterialButton.java:228)
	at com.google.android.material.button.MaterialButton.<init>(MaterialButton.java:219)
	at com.google.android.material.theme.MaterialComponentsViewInflater.createButton(MaterialComponentsViewInflater.java:43)
	at androidx.appcompat.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:129)
	at androidx.appcompat.app.AppCompatDelegateImpl.createView(AppCompatDelegateImpl.java:1569)
	at androidx.appcompat.app.AppCompatDelegateImpl.onCreateView(AppCompatDelegateImpl.java:1620)
	at com.microsoft.intune.mam.client.view.LayoutInflaterManagementBehaviorImpl$FactoryWrapper.onCreateView(:78)
	at android.view.LayoutInflater.tryCreateView(LayoutInflater.java:1061)
	at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:997)
	at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:961)
	at android.view.LayoutInflater.rInflate(LayoutInflater.java:1123)
	at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1084)
	at android.view.LayoutInflater.rInflate(LayoutInflater.java:1126)
	at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1084)
	at android.view.LayoutInflater.parseInclude(LayoutInflater.java:1263)
	at android.view.LayoutInflater.rInflate(LayoutInflater.java:1119)
	at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1084)
	at android.view.LayoutInflater.inflate(LayoutInflater.java:682)
	at android.view.LayoutInflater.inflate(LayoutInflater.java:534)
	at android.view.LayoutInflater.inflate(LayoutInflater.java:481)
	at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:541)
	at com.android.internal.app.AlertController.installContent(AlertController.java:291)
	at android.app.AlertDialog.onCreate(AlertDialog.java:443)
	at android.app.Dialog.dispatchOnCreate(Dialog.java:702)
	at android.app.Dialog.show(Dialog.java:424)
	at com.microsoft.intune.mam.client.view.ApprovedKeyboardsDialogHelper.showKeyboardInstallDialog(:253)
	at com.microsoft.intune.mam.client.view.ApprovedKeyboardsDialogHelper.restrictKeyboards(:164)
	at com.microsoft.intune.mam.client.view.ApprovedKeyboardsDialogHelper.showKeyboardRestrictedDialogIfNecessary(:143)
	at com.microsoft.intune.mam.client.view.EditorViewBehaviorImpl.onCreateInputConnection(:96)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.microsoft.intune.mam.InterProxy$InterInvocationHandler.invoke(:88)
	at java.lang.reflect.Proxy.invoke(Proxy.java:1006)
	at $Proxy37.onCreateInputConnection(Unknown Source)
	at com.microsoft.intune.mam.client.widget.MAMAutoCompleteTextView.onCreateInputConnection(MAMAutoCompleteTextView.java:90)
	at android.view.inputmethod.InputMethodManager.startInputInner(InputMethodManager.java:2118)
	at android.view.inputmethod.InputMethodManager.checkFocus(InputMethodManager.java:2452)
	at android.view.inputmethod.InputMethodManager.displayCompletions(InputMethodManager.java:1430)
	at android.widget.AutoCompleteTextView.dismissDropDown(AutoCompleteTextView.java:1206)

Smartphone (please complete the following information):

  • Device: Samsung SM-G965F
  • OS: 10

Intune App SDK for Android (please complete the following information):

  • What version of the Intune SDK are you using? => 9.1.0 Are you using the latest version? => Yes
  • What platform is your app based in (Java, Xamarin based, Cordova, etc)? => Native Android
  • For errors during build, does the app build without Intune SDK integration?
  • For errors post build, does the app launch without being Intune SDK integrated? => Yes
  • Who is the customer?
  • Do you see a trend with it only being reproduced on a specific device? => No

Additional context:
Add any other context about the problem here.

@meghandaly meghandaly added the Under Investigation The issue is currently being investigated by the product team. label Dec 22, 2022
@meghandaly
Copy link
Collaborator

@daniel-m-dd Thank you for reporting this issue. We are looking into reproducing this internally. In the meantime, can you reproduce the scenario and share the Incident ID from the Company Portal logs?

@meghandaly
Copy link
Collaborator

MAM Note: Tracking internally with #17015578

@meghandaly meghandaly added the Bug label Feb 3, 2023
@daniel-m-dd
Copy link
Author

@meghandaly Here is the incident id: DYYQPBG3.
Thanks!

@codylund
Copy link
Collaborator

codylund commented Mar 6, 2023

@daniel-m-dd are you still having this issue? Do you mind sharing any custom theme settings for your app, or a minimal sample application that reproduces the issue?

When attempting to reproduce this issue with SearchView in androidx.appcompat:appcompat:1.6.1, I could not use SearchView without switching the app's theme to Theme.AppCompat (or a descendant). Did you make a similar change in your app? If you are able to successfully use SearchView, it is surprising that the MAM SDK's keyboard install dialog would throw an error because it "requires your app theme to be Theme.AppCompat (or a descendant)."

@codylund codylund added Closed - Not Enough Info Issue did not contain enough actionable information and was not updated. Need More Information Waiting for more information from issuer in order to resolve issue. and removed Under Investigation The issue is currently being investigated by the product team. Closed - Not Enough Info Issue did not contain enough actionable information and was not updated. labels Mar 6, 2023
@daniel-m-dd
Copy link
Author

@codylund Yes, I am still having the issue.
Our app is using the Theme.MaterialComponents.DayNight.NoActionBar but overriding the attribute with Widget.AppCompat.SearchView.ActionBar. However not overriding searchViewStyle does not fix it either and seem unrelated...

Side note 1: we are using androidx.appcompat:appcompat:1.5.1 but upgrading to 1.6.1 had no impact.
Side note 2: we also ruled out this issue

@bannus bannus added Under Investigation The issue is currently being investigated by the product team. and removed Need More Information Waiting for more information from issuer in order to resolve issue. labels May 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Under Investigation The issue is currently being investigated by the product team.
Projects
None yet
Development

No branches or pull requests

4 participants