title: MANAGE_EXTERNAL_STORAGE is not calling registerForActivityResult
body: <p>I'm upgrading the app to target android 12, before its targeting android 10. So, now I'm using <code>MANAGE_EXTERNAL_STORAGE</code> with <code>registerForActivityResult</code> but when user <strong>allow access to manage files</strong> and press back button the <code>registerForActivityResult</code> do not get called. Here is my code.<br />
  In <code>onCreate</code> method</p>
  <pre><code>    registerLauncher();
      if (checkPermissionsGranted()) {
          initMainActivity();
      } else {
          requestPermission();
      }
  </code></pre>
  <p>The above methods in sequence.</p>
  <pre><code>private void registerLauncher() {
          permissionLauncher = registerForActivityResult(
                  new ActivityResultContracts.StartActivityForResult(), new ActivityResultCallback&lt;ActivityResult&gt;() {
                      @Override
                      public void onActivityResult(ActivityResult result) {
                          if (result.getResultCode() == Activity.RESULT_OK) {
                              Log.e(TAG, &quot;inside activity result&quot;);
                              initMainActivity();
                          }
                      }
                  });
      }
  
  private boolean checkPermissionsGranted() {
          if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.R) {
              return Environment.isExternalStorageManager();
          } else {
              int readPermission = ContextCompat.checkSelfPermission(mContext, Manifest.permission.READ_EXTERNAL_STORAGE);
              int writePermission = ContextCompat.checkSelfPermission(mContext, Manifest.permission.WRITE_EXTERNAL_STORAGE);
  //            int storagePermission = ContextCompat.checkSelfPermission(mContext, Manifest.permission_group.STORAGE);
              return readPermission == PackageManager.PERMISSION_GRANTED &amp;&amp; writePermission == PackageManager.PERMISSION_GRANTED;
          }
      }
  
      private void requestPermission() {
          if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.R) {
              try {
  //                Uri uri = Uri.parse(&quot;package:&quot; + BuildConfig.APPLICATION_ID);
  //                Intent intent = new Intent(Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION, uri);
  //                startActivity(intent);
  //                permissionLauncher.launch(intent);
  //                startActivityForResult(intent, AppConstants.STORAGE_PERMISSION_CODE);
                  Intent intent = new Intent(Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION);
                  intent.addCategory(&quot;android.intent.category.DEFAULT&quot;);
                  intent.setData(Uri.parse(String.format(&quot;package:%s&quot;, getApplicationContext().getPackageName())));
               //   startActivityForResult(intent, AppConstants.STORAGE_PERMISSION_CODE);
                  permissionLauncher.launch(intent);
              } catch (Exception e) {
                  Log.e(TAG, &quot;Exp... &quot; + e.toString());
                  Intent intent = new Intent(Settings.ACTION_MANAGE_ALL_FILES_ACCESS_PERMISSION);
                  permissionLauncher.launch(intent);
              }
          } else {
              ActivityCompat.requestPermissions(Splashscreen.this, new String[]{Manifest.permission_group.STORAGE}, AppConstants.STORAGE_PERMISSION_CODE);
          }
      }
  </code></pre>
  <p>I also tried with <code>startActivityForResult(intent, AppConstants.STORAGE_PERMISSION_CODE);</code> (I know <code>startActivityForResult</code> is deprecated) with overriding <code>onRequestPermissionsResult</code> but none of these two get called<br />
  1 - registerForActivityResult<br />
  2 - onRequestPermissionsResult</p>
  <p>Please let me know what I'm doing wrong here? As I'm check the permission on splash activity, the app get stuck on the splash as onResult is not being called.</p>
  <p>Thanks &amp; Regards</p>