FileDocCategorySizeDatePackage
InstallAppConfirmation.javaAPI DocAndroid 1.5 API4848Wed May 06 22:42:46 BST 2009com.android.packageinstaller

InstallAppConfirmation

public class InstallAppConfirmation extends android.app.Activity implements View.OnClickListener
This activity corresponds to a confirmation screen that is displayed when the user tries to install an application bundled as an apk file. The intent that launches this activity should include the application information object of the application(to be installed) and a list of permission strings associated with the application. This information is displayed on the screen and installation is either continued or canceled based on the user response(click ok or cancel).

Fields Summary
private final String
TAG
private boolean
localLOGV
private android.widget.Button
mOk
private android.widget.Button
mCancel
private android.content.pm.ApplicationInfo
mAppInfo
private android.net.Uri
mPkgURI
private android.view.View
mContentView
Constructors Summary
Methods Summary
public voidinitView()

        requestWindowFeature(Window.FEATURE_NO_TITLE);
        String unknown =  getString(R.string.unknown);
        //set description
        String desc = getString(R.string.security_settings_desc);
        if(desc == null) {
            desc = unknown;
        }
        LayoutInflater inflater = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        mContentView = inflater.inflate(R.layout.install_confirm, null);
        setContentView(mContentView);
        //initialize views
        PackageUtil.initAppSnippet(this, mAppInfo, R.id.app_snippet);
        if(desc != null) {
            ((TextView)findViewById(R.id.security_settings_desc)).setText(desc);
        }
        
        
        LinearLayout permsView = (LinearLayout) mContentView.findViewById(
                R.id.permissions_section);
        boolean permVisible = false;
        PackageParser.Package pkg = PackageUtil.getPackageInfo(mPkgURI);
        if(pkg != null) {
            AppSecurityPermissions asp = new AppSecurityPermissions(this, pkg);
            if(asp.getPermissionCount() > 0) {
                permVisible = true;
                permsView.setVisibility(View.VISIBLE);
                LinearLayout securityList = (LinearLayout) permsView.findViewById(
                        R.id.security_settings_list);
                securityList.addView(asp.getPermissionsView());
            } 
        }
        if(!permVisible){
            permsView.setVisibility(View.GONE);
        }
        mOk = (Button)findViewById(R.id.ok_button);
        mCancel = (Button)findViewById(R.id.cancel_button);
        mOk.setOnClickListener(this);
        mCancel.setOnClickListener(this);
    
public voidonClick(android.view.View v)

        int result = RESULT_CANCELED;
        if(v == mOk) {
            result = RESULT_OK;
            setResultAndReturn(result);
        } else if(v == mCancel) {
            result = RESULT_CANCELED;
            setResultAndReturn(result);
        }
    
public voidonCreate(android.os.Bundle icicle)

    
    
        
        super.onCreate(icicle);
        Intent intent = getIntent();
        if(localLOGV) Log.i(TAG, "intent="+intent);
        mAppInfo = intent.getParcelableExtra(PackageUtil.INTENT_ATTR_APPLICATION_INFO);
        mPkgURI = intent.getData();        
        if(localLOGV) Log.i(TAG, "mAppInfo = "+mAppInfo);
        initView();
    
public voidsetResultAndReturn(int result)

        if(result == RESULT_CANCELED) Log.i(TAG, "Result has been canceled");
        if(result == RESULT_OK) Log.i(TAG, "result ok");
        setResult(result);
        finish();