@@ -780,28 +780,28 @@ void doHandleMessage(Message msg) {
780780 final int verificationId = msg .arg1 ;
781781 final PackageVerificationState state = mPendingVerification .get (verificationId );
782782
783- if (state != null ) {
783+ if (( state != null ) && ! state . timeoutExtended () ) {
784784 final InstallArgs args = state .getInstallArgs ();
785785 Slog .i (TAG , "Verification timed out for " + args .packageURI .toString ());
786786 mPendingVerification .remove (verificationId );
787787
788788 int ret = PackageManager .INSTALL_FAILED_VERIFICATION_FAILURE ;
789789
790790 if (getDefaultVerificationResponse () == PackageManager .VERIFICATION_ALLOW ) {
791- Slog .i (TAG , "Continuing with installation of " + args .packageURI .toString ());
792- state .setVerifierResponse (Binder .getCallingUid (), PackageManager .VERIFICATION_ALLOW_WITHOUT_SUFFICIENT );
793- try {
794- ret = args .copyApk (mContainerService , true );
795- } catch (RemoteException e ) {
796- Slog .e (TAG , "Could not contact the ContainerService" );
797- }
791+ Slog .i (TAG , "Continuing with installation of "
792+ + args .packageURI .toString ());
793+ state .setVerifierResponse (Binder .getCallingUid (),
794+ PackageManager .VERIFICATION_ALLOW_WITHOUT_SUFFICIENT );
795+ try {
796+ ret = args .copyApk (mContainerService , true );
797+ } catch (RemoteException e ) {
798+ Slog .e (TAG , "Could not contact the ContainerService" );
799+ }
798800 }
799801
800802 processPendingInstall (args , ret );
801-
802803 mHandler .sendEmptyMessage (MCS_UNBIND );
803804 }
804-
805805 break ;
806806 }
807807 case PACKAGE_VERIFIED : {
@@ -5393,6 +5393,32 @@ public void verifyPendingInstall(int id, int verificationCode) throws RemoteExce
53935393 mHandler .sendMessage (msg );
53945394 }
53955395
5396+ @ Override
5397+ public void extendVerificationTimeout (int id , int verificationCodeAtTimeout ,
5398+ long millisecondsToDelay ) {
5399+ final PackageVerificationState state = mPendingVerification .get (id );
5400+ final PackageVerificationResponse response = new PackageVerificationResponse (
5401+ verificationCodeAtTimeout , Binder .getCallingUid ());
5402+
5403+ if ((millisecondsToDelay > PackageManager .MAXIMUM_VERIFICATION_TIMEOUT )
5404+ || (millisecondsToDelay < 0 )) {
5405+ throw new IllegalArgumentException ("millisecondsToDelay is out of bounds." );
5406+ }
5407+ if ((verificationCodeAtTimeout != PackageManager .VERIFICATION_ALLOW )
5408+ || (verificationCodeAtTimeout != PackageManager .VERIFICATION_REJECT )) {
5409+ throw new IllegalArgumentException ("verificationCodeAtTimeout is unknown." );
5410+ }
5411+
5412+ if ((state != null ) && !state .timeoutExtended ()) {
5413+ state .extendTimeout ();
5414+
5415+ final Message msg = mHandler .obtainMessage (PACKAGE_VERIFIED );
5416+ msg .arg1 = id ;
5417+ msg .obj = response ;
5418+ mHandler .sendMessageDelayed (msg , millisecondsToDelay );
5419+ }
5420+ }
5421+
53965422 private ComponentName matchComponentForVerifier (String packageName ,
53975423 List <ResolveInfo > receivers ) {
53985424 ActivityInfo targetReceiver = null ;
0 commit comments