title: When opening app while keeping device in landscape mode then, on Portrait activity dialog is showing landscape orientation
body: <p>As per product requirement I have to keep the orientation of app to portrait for mobile and landscape for tablet.
  Used following code to set orientation for each activity in <code>onCreate()</code> callback before invoking <code>super.onCreate()</code></p>
  
  <pre><code>public static void updateOrientation(Activity activity) {
      boolean hasAPI18 = Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.JELLY_BEAN_MR2;
      if (isTablet()) {
          activity.setRequestedOrientation(hasAPI18 ? ActivityInfo.SCREEN_ORIENTATION_USER_LANDSCAPE : ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
      } else {
          activity.setRequestedOrientation(hasAPI18 ? ActivityInfo.SCREEN_ORIENTATION_USER_PORTRAIT : ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
      }
  }
  </code></pre>
  
  <p><strong>Working scenario For Mobile:</strong></p>
  
  <ol>
  <li>Keep device in portrait orientation</li>
  <li>Open application</li>
  <li>Do event to show dialog</li>
  </ol>
  
  <p><strong>Result:</strong> On portrait activity, Dialog show properly in portrait mode.</p>
  
  <p><strong>Error scenario For Mobile:</strong></p>
  
  <ol>
  <li>Keep device in landscape orientation</li>
  <li>Open application</li>
  <li>Do event to show dialog</li>
  </ol>
  
  <p><strong>Result:</strong> On portrait activity Dialog shows in landscapemode due to which only 2/3 part of dialog is visible.</p>
  
  <p><strong>Verified:</strong> </p>
  
  <ol>
  <li>Activity orientation and window orientation is set to portrait while showing dialog on mobile.</li>
  </ol>