首页 > 编程知识 正文

install是什么意思中文,installation aborted

时间:2023-05-05 21:33:30 阅读:107975 作者:2364

安卓安装过程.错误报告

install _ failed _ aborted 3360 sessionwasabandoned

在网上调查的安装过程中,在安装的最后使用

getPackageManager ().getPackageInstaller ).Abandonsession ) msessionid;

你不知道吗,这句话是导致这个误报的苗条烤鸡

在通常的流程中,没有必要使用这个词。 只有例外处理才使用这个词

可以从源代码中看到:

客户端

官方入口

frameworks/base/packages/package installer/src/com/Android/package installer/install ing.Java

/* * sendthepackagetothepackageinstallerandthenregisteraeventresultobserverthat * will call { @ link # launchfinishbasedonrect privatefinalclassinstallingasynctaskextendsasynctaskvoid,void, package installer.session volatilebooleaniii @ overrideprotectedpackageinstaller.sessiondoinbackground (void . params ) try { session=getPackageManager ().getPackageInstaller ) ).opensession ) msessionid ); }catch(ioexceptione ) synchronized (this ) { isDone=true; 通知全部(; }返回空值; }session.setstagingprogress(0; try { file file=new file (mpackageuri.getpath (); 输入流(inputstream in=new file inputstream (file ) ) { long sizeBytes=file.length; 输出流输出=session.open write (package installer (0,sizeBytes ) ) byte (buffer=new byte ) 1024 * 1000 while if(numread==-1 ) {session.fsync(out ); 布雷克; }if(iscancelled () ) { session.close; 布雷克; }out.write(buffer,0,numRead ); if(sizeBytes0) floatfraction=() float (numread/) float (size bytes ); session.addprogress(Fraction ); }

} } } return session; } catch (IOException | SecurityException e) { Log.e(LOG_TAG, "Could not write package", e); session.close(); return null; } finally { synchronized (this) { isDone = true; notifyAll(); } } } @Override protected void onPostExecute(PackageInstaller.Session session) { if (session != null) { Intent broadcastIntent = new Intent(BROADCAST_ACTION); broadcastIntent.setFlags(Intent.FLAG_RECEIVER_FOREGROUND); broadcastIntent.setPackage(getPackageName()); broadcastIntent.putExtra(EventResultPersister.EXTRA_ID, mInstallId); PendingIntent pendingIntent = PendingIntent.getBroadcast( InstallInstalling.this, mInstallId, broadcastIntent, PendingIntent.FLAG_UPDATE_CURRENT); session.commit(pendingIntent.getIntentSender()); mCancelButton.setEnabled(false); setFinishOnTouchOutside(false); } else { getPackageManager().getPackageInstaller().abandonSession(mSessionId); if (!isCancelled()) { launchFailure(PackageManager.INSTALL_FAILED_INVALID_APK, null); } } } }

frameworks/base/core/java/android/content/pm/PackageInstaller.java

/** * Completely abandon this session, destroying all staged data and * rendering it invalid. Abandoned sessions will be reported to * {@link SessionCallback} listeners as failures. This is equivalent to * opening the session and calling {@link Session#abandon()}. * 完全放弃此会话,破坏所有暂存的数据并使之无效。 放弃的会话将作为失败报告给{@link * SessionCallback}侦听器。 这等效于打开会话并调用{@link Session#abandon()}。 */ public void abandon() { try { mSession.abandon(); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } }

service端
真正执行的地方
frameworks/base/services/core/java/com/android/server/pm/PackageInstallerService.java
frameworks/base/services/core/java/com/android/server/pm/PackageInstallerSession.java

@Override public void abandon() { if (hasParentSessionId()) { throw new IllegalStateException( "Session " + sessionId + " is a child of multi-package session " + mParentSessionId + " and may not be abandoned directly."); } List<PackageInstallerSession> childSessions = getChildSessionsNotLocked(); synchronized (mLock) { if (params.isStaged && mDestroyed) { // If a user abandons staged session in an unsafe state, then system will try to // abandon the destroyed staged session when it is safe on behalf of the user. assertCallerIsOwnerOrRootOrSystemLocked(); } else { assertCallerIsOwnerOrRootLocked(); } if (isStagedAndInTerminalState()) { // We keep the session in the database if it's in a finalized state. It will be // removed by PackageInstallerService when the last update time is old enough. // Also, in such cases cleanStageDir() has already been executed so no need to // do it now. return; } if (mCommitted && params.isStaged) { mDestroyed = true; if (!mStagingManager.abortCommittedSessionLocked(this)) { // Do not clean up the staged session from system. It is not safe yet. mCallback.onStagedSessionChanged(this); return; } cleanStageDir(childSessions); } if (mRelinquished) { Slog.d(TAG, "Ignoring abandon after commit relinquished control"); return; } destroyInternal(); } dispatchSessionFinished(INSTALL_FAILED_ABORTED, "Session was abandoned", null); }

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。