Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a2011d23 authored by Svetoslav's avatar Svetoslav
Browse files

Adding missing permission API to fragment

Change-Id: I90309a23a08a82f0ab93eb4f6185db09e035aac1
parent 981975a3
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -4384,6 +4384,7 @@ package android.app {
    method public void setSharedElementReturnTransition(android.transition.Transition);
    method public void setTargetFragment(android.app.Fragment, int);
    method public void setUserVisibleHint(boolean);
    method public boolean shouldShowRequestPermissionRationale(java.lang.String);
    method public void startActivity(android.content.Intent);
    method public void startActivity(android.content.Intent, android.os.Bundle);
    method public void startActivityForResult(android.content.Intent, int);
+1 −0
Original line number Diff line number Diff line
@@ -4480,6 +4480,7 @@ package android.app {
    method public void setSharedElementReturnTransition(android.transition.Transition);
    method public void setTargetFragment(android.app.Fragment, int);
    method public void setUserVisibleHint(boolean);
    method public boolean shouldShowRequestPermissionRationale(java.lang.String);
    method public void startActivity(android.content.Intent);
    method public void startActivity(android.content.Intent, android.os.Bundle);
    method public void startActivityForResult(android.content.Intent, int);
+27 −0
Original line number Diff line number Diff line
@@ -1222,6 +1222,33 @@ public class Fragment implements ComponentCallbacks2, OnCreateContextMenuListene
        /* callback - do nothing */
    }

    /**
     * Gets whether you should show UI with rationale for requesting a permission.
     * You should do this only if you do not have the permission and the context in
     * which the permission is requested does not clearly communicate to the user
     * what would be the benefit from granting this permission.
     * <p>
     * For example, if you write a camera app, requesting the camera permission
     * would be expected by the user and no rationale for why it is requested is
     * needed. If however, the app needs location for tagging photos then a non-tech
     * savvy user may wonder how location is related to taking photos. In this case
     * you may choose to show UI with rationale of requesting this permission.
     * </p>
     *
     * @param permission A permission your app wants to request.
     * @return Whether you can show permission rationale UI.
     *
     * @see Context#checkSelfPermission(String)
     * @see #requestPermissions(String[], int)
     * @see #onRequestPermissionsResult(int, String[], int[])
     */
    public boolean shouldShowRequestPermissionRationale(@NonNull String permission) {
        if (mHost != null) {
            mHost.getContext().getPackageManager().shouldShowRequestPermissionRationale(permission);
        }
        return false;
    }

    /**
     * @hide Hack so that DialogFragment can make its Dialog before creating
     * its views, and the view construction can use the dialog's context for