Request permission dialog blackout the activity and pressing any key is closing the activity
<p>I dont know why this happening just for one app because i tried it on other apps it works fine. But only this app whenever i request a permission the activity blacks out and only the permission dialog appears then pressing "Allow" or "Deny" will close the activity and i need to reopen it. 
I am suspecting that this behavior is happening upon some varieties upon themes or extending types of the Activity like "AppCompactActivity" or "ActionBarActivity".</p>

<p>This is my code </p>

<pre><code>if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED &amp;&amp; ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED&amp;&amp; ActivityCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED)
{
        ActivityCompat.requestPermissions(this,new String[]{Manifest.permission.ACCESS_FINE_LOCATION,Manifest.permission.ACCESS_COARSE_LOCATION}, 1);
}

@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String permissions[], @NonNull int[] grantResults)
{
    switch (requestCode)
    {
        case 1:
            // If request is cancelled, the result arrays are empty.
            if (grantResults.length &gt; 0 &amp;&amp; grantResults[0] == PackageManager.PERMISSION_GRANTED)
            {
                Log.e("Permission","Granted");
            }
            else
            {
                Log.e("Permission","Not Granted");
            }

            break;
    }
}
</code></pre>

<p>and this is the themes but its only a suspect that the theme is the reason</p>

<pre><code>&lt;resources&gt;

&lt;!-- Base application theme. --&gt;
&lt;style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"&gt;
    &lt;item name="android:windowBackground"&gt;@color/primary_orange_lighter&lt;/item&gt;
&lt;/style&gt;

&lt;style name="AppTheme.Splash_Activity" parent="Theme.AppCompat.Light.NoActionBar"&gt;
    &lt;item name="android:statusBarColor"&gt;@color/primary_orange_lighter&lt;/item&gt;
&lt;/style&gt;

&lt;style name="AppTheme.Login_Activity" parent="Theme.AppCompat.Light.NoActionBar"&gt;
    &lt;item name="android:statusBarColor"&gt;@color/primary_orange_lighter&lt;/item&gt;
&lt;/style&gt;

&lt;style name="AppTheme.Main_Activity" parent="Theme.AppCompat.Light.NoActionBar"&gt;
    &lt;item name="android:statusBarColor"&gt;@color/primary_orange_lighter&lt;/item&gt;
&lt;/style&gt;


&lt;style name="StarRatingBar" parent="@android:style/Widget.RatingBar"&gt;
    &lt;item name="android:progressDrawable"&gt;@drawable/star_rating_bar_full&lt;/item&gt;
    &lt;item name="android:minHeight"&gt;48dip&lt;/item&gt;
    &lt;item name="android:maxHeight"&gt;48dip&lt;/item&gt;
&lt;/style&gt;

&lt;style name="Dialog" parent="@android:style/Theme.Holo.Dialog.NoActionBar"&gt;
    &lt;item name="android:color"&gt;#FFFFFFFF&lt;/item&gt;
    &lt;item name="android:windowBackground"&gt;@color/trans_white&lt;/item&gt;
    &lt;item name="android:windowMinWidthMajor"&gt;90%&lt;/item&gt;
    &lt;item name="android:windowMinWidthMinor"&gt;90%&lt;/item&gt;

&lt;/style&gt;

&lt;style name="ToolBarStyle" parent="AppTheme.Main_Activity"&gt;
    &lt;item name="android:statusBarColor"&gt;@color/primary_orange_lighter&lt;/item&gt;
    &lt;item name="android:background"&gt;@color/primary_orange_lighter&lt;/item&gt;
    &lt;item name="android:textColorPrimary"&gt;@android:color/white&lt;/item&gt;
    &lt;item name="drawerArrowStyle"&gt;@style/DrawerArrowStyle&lt;/item&gt;
&lt;/style&gt;

&lt;style name="DrawerArrowStyle" parent="Widget.AppCompat.DrawerArrowToggle"&gt;
    &lt;item name="spinBars"&gt;false&lt;/item&gt;
    &lt;item name="color"&gt;@android:color/white&lt;/item&gt;
&lt;/style&gt;

&lt;style name="CustomLoadingDialog" parent="SpotsDialogDefault"&gt;
    &lt;item name="DialogTitleAppearance"&gt;@android:style/TextAppearance.Medium&lt;/item&gt;
    &lt;item name="DialogTitleText"&gt;Loading&lt;/item&gt;
    &lt;item name="android:textColor"&gt;@color/white&lt;/item&gt;
    &lt;item name="android:background"&gt;@color/black&lt;/item&gt;
    &lt;item name="DialogSpotColor"&gt;@color/white&lt;/item&gt;
    &lt;item name="DialogSpotCount"&gt;5&lt;/item&gt;
&lt;/style&gt;


&lt;style name="AppTheme.NoActionBar"&gt;
    &lt;item name="windowActionBar"&gt;false&lt;/item&gt;
    &lt;item name="windowNoTitle"&gt;true&lt;/item&gt;
&lt;/style&gt;

&lt;style name="SwitchButtonStyle"&gt;
    &lt;item name="android:paddingLeft"&gt;10dp&lt;/item&gt;
    &lt;item name="android:paddingRight"&gt;10dp&lt;/item&gt;
    &lt;item name="android:paddingTop"&gt;4dp&lt;/item&gt;
    &lt;item name="android:paddingBottom"&gt;4dp&lt;/item&gt;
&lt;/style&gt;



&lt;style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" /&gt;

&lt;style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" /&gt;
</code></pre>

<p></p>

<p>and this is the class where the request is occurring</p>

<pre><code>import android.Manifest;
import android.content.pm.PackageManager;
import android.support.annotation.NonNull;
import android.support.v4.app.ActivityCompat;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;

import syncworx.com.kunhadi_driver.R;
import syncworx.com.kunhadi_driver.classes.Constants;

public class Test_Activity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState)
{
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_test);

    if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED &amp;&amp; ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED&amp;&amp; ActivityCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED)
    {
        ActivityCompat.requestPermissions(this,new String[]{Manifest.permission.ACCESS_FINE_LOCATION,Manifest.permission.ACCESS_COARSE_LOCATION}, 1);
    }
}

@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String permissions[], @NonNull int[] grantResults)
{
    switch (requestCode)
    {
        case 1:
            // If request is cancelled, the result arrays are empty.
            if (grantResults.length &gt; 0 &amp;&amp; grantResults[0] == PackageManager.PERMISSION_GRANTED)
            {
                Log.e("Permission","Granted");
            }
            else
            {
                Log.e("Permission","Not Granted");
            }

            break;
    }
}
}
</code></pre>