1. android8.0雙屏顯示異常,主屏啟動的Activity會顯示到副屏上的問題
問題現象:
由於設備有兩個Display設備,分為主屏和副屏,正常情況下startActivity如果不指定displayId的話,都會默認顯示在主屏上,但是在某些情況下launcher啟動的應用Activity會顯示到副屏上面去。
根據現象來分析,初步判斷問題原因是startActivity的流程出現異常導致的,那麼就需要從startActivity流程開始查找原因。
先看framework\base\services\core\java\com\android\server\am\ActivityStarter.java中的:
```
int startActivityLocked(IApplicationThread caller, Intent intent, Intent ephemeralIntent,
...) {
...
mLastStartActivityResult = startActivity(caller, intent, ephemeralIntent, resolvedType,
aInfo, rInfo, voiceSession, voiceInteractor, resultTo, resultWho, requestCode,
callingPid, callingUid, callingPackage, realCallingPid, realCallingUid, startFlags,
options, ignoreTargetSecurity, componentSpecified, mLastStartActivityRecord,
inTask);
...
}
```
一步一步往下查之後看到startActivityUnchecked函數中有對task和stack的變更與displayId相關的操作,重點看這個地方:
// Note: This method should only be called from {@link startActivity}.
private int startActivityUnchecked(final ActivityRecord r, ActivityRecord sourceRecord,
IVoiceInteractionSession voiceSession, IVoiceInteractor voiceInteractor,
int startFlags, boolean doResume, ActivityOptions options, TaskRecord inTask,
ActivityRecord[] outActivity) {
...
// Should this be considered a new task?
int result = START_SUCCESS;
if (mStartActivity.resultTo == null && mInTask == null && !mAddingToTask
&& (mLaunchFlags & FLAG_ACTIVITY_NEW_TASK) != 0) {
newTask = true;
String packageName= mService.mContext.getPackageName();
if (mPerf != null) {
mStartActivity.perfActivityBoostHandler =
mPerf.perfHint(BoostFramework.VENDOR_HINT_FIRST_LAUNCH_BOOST, packageName, -1, BoostFramework.Launch.BOOST_V1);
}
result = (
taskToAffiliate, preferredLaunchStackId, topStack);
} else if (mSourceRecord != null) {
result = setTaskFromSourceRecord(); //在添加列印後發現出現問題的時候是走的這個函數進行task與stack操作的
} else if (mInTask != null) {
result = setTaskFromInTask();
} else {
// This not being started from an existing activity, and not part of a new task...
// just put it in the top task, though these days this case should never happen.
();
}
...
}
那麼就看setTaskFromSourceRecord這個函數幹了些什麼:
private int setTaskFromSourceRecord() {
...
// We only want to allow changing stack in two cases:
// 1. If the target task is not the top one. Otherwise we would move the launching task to
// the other side, rather than show two side by side.
// 2. If activity is not allowed on target display.
final int targetDisplayId = mTargetStack != null ? mTargetStack.mDisplayId
: sourceStack.mDisplayId;
final boolean moveStackAllowed = sourceStack.topTask() != sourceTask
|| !mStartActivity.canBeLaunchedOnDisplay(targetDisplayId);
if (moveStackAllowed) {
mTargetStack = getLaunchStack(mStartActivity, mLaunchFlags, mStartActivity.getTask(),
mOptions);
// If target stack is not found now - we can't just rely on the source stack, as it may
// be not suitable. Let's check other displays.
if (mTargetStack == null && targetDisplayId != sourceStack.mDisplayId) {
// Can't use target display, lets find a stack on the source display.
mTargetStack = mService.mStackSupervisor.getValidLaunchStackOnDisplay(
sourceStack.mDisplayId, mStartActivity);
}
if (mTargetStack == null) {
// There are no suitable stacks on the target and source display(s). Look on all
// displays.
mTargetStack = mService.mStackSupervisor.getNextValidLaunchStackLocked(
mStartActivity, -1/* currentFocus */);
}
}
}
根據注釋來看,關鍵就是這個moveStackAllowed了,列印log發現出現問題的時候moveStackAllowed 為true,所以會對mTargetStack 進行重新賦值的操作,在重新賦值操作過程中,由於當前topTask所在的stack是副屏的,所以會進入mService.mStackSupervisor.getNextValidLaunchStackLocked查找非-1的displayId對應的ActivityStack來賦值。
/**
* Get next valid stack for launching provided activity in the system. This will search across
* displays and stacks in last-focused order for a focusable and visible stack, except those
* that are on a currently focused display.
*
* @param r The activity that is being launched.
* @param currentFocus The display that previously had focus and thus needs to be ignored when
* searching for the next candidate.
* @return Next valid {@link ActivityStack}, null if not found.
*/
ActivityStack getNextValidLaunchStackLocked(@NonNull ActivityRecord r, int currentFocus) {
mWindowManager.getDisplaysInFocusOrder(mTmpOrderedDisplayIds);
for (int i = mTmpOrderedDisplayIds.size() - 1; i >= 0; --i) {
final int displayId = mTmpOrderedDisplayIds.get(i);
if (displayId == currentFocus) {
continue;
}
final ActivityStack stack = getValidLaunchStackOnDisplay(displayId, r);
if (stack != null) {
return stack;
}
}
return null;
}
從getNextValidLaunchStackLocked內部可以看到按照displayId由小到大的順序依次添加到mTmpOrderedDisplayIds這個列表中去,然後再由大到小依次遍歷mTmpOrderedDisplayIds非-1的displayId對應的ActivityStack,由於設備的主屏和副屏的displayId分別是0、1,所以最先查到的就是displayId為1的ActivityStack,這樣activity就會顯示到副屏對應的ActivityStack上,從而導致默認啟動的activity在副屏上顯示的問題。
知道原因就好辦了,直接在setTaskFromSourceRecord中添加判斷:
if (mTargetStack == null) {
// There are no suitable stacks on the target and source display(s). Look on all
// displays.
ActivityStack topStack = mSupervisor.mFocusedStack;
int currentFocusDisplayId = -1;
//如果topStack對應的displayId不等於startActivity傳入的targetDisplayId,那麼就在getNextValidLaunchStackLocked中傳入topStack.mDisplayId排除掉對應的topStack就行了。
if (topStack != null && topStack.mDisplayId != targetDisplayId) {
currentFocusDisplayId = topStack.mDisplayId;
}
mTargetStack = mService.mStackSupervisor.getNextValidLaunchStackLocked(
mStartActivity, currentFocusDisplayId /* currentFocus */);
}
2. 雙屏可折疊手機嶄露頭角,安卓誤刪的通話記錄怎麼恢復
最近一段時間,各大手機廠商紛紛發布自家的全面屏手機,幾乎已成為手機行業的潮流一樣,更是競爭不斷。這種局面總是要有人打破的,沉寂已久的國產老牌中興在美國紐約布魯克林舉辦新品發布會,推出全球首款雙屏折疊手機AXON M,正式展開與全面屏的對決。
其他公司也緊跟步伐,包括三星和微軟都有相關專利,暗示正在研發可折疊或可彎曲屏幕的智能手機,這其中涉及到傳聞中的三星Galaxy X和微軟Surface Phone。
這款手機最大的亮點,就是採用了類似筆記本的「鉸鏈」設計,鏈接兩款屏幕,彷彿又將人們的視野拉回了多年前的翻蓋手機。值得一提的是,手機的雙屏幕可以同時顯示兩個應用程序,提供類似PC的多任務處理體驗。
中興認為,隨著智能手機多任務處理的需求不斷增長,受限於屏幕,現有的市場解決方案並不能很好的解決。這也是雙屏折疊手機AXON M誕生的初衷。
據了解,AXON M有三種使用形態:
1、延展模式,兩塊屏幕拼在一起,提供6.8英寸超大顯示屏,在該模式下,兩塊屏幕的內容連接在一起,更像是一款平板電腦;
2、雙屏模式,兩塊屏幕可以獨立運行不同的應用程序,比如一個屏幕聊天,一個屏幕看電影。甚至,它能讓兩個人,在一款手機上玩多人游戲。
3、鏡像模式,兩款屏幕顯示一樣的內容。在該模式下,兩個人可以同時分享一個內容。
然而大家在使用安卓手機的時候,總是會不慎刪除了通話記錄,那麼誤刪的通話記錄該怎麼恢復呢?這個時候就要用到強力數據恢復軟體了。
一、運行強力安卓恢復精靈,將手機通過數據線連接到電腦上。
二、成功連接後,軟體上會顯示出手機信息,選擇設備後點擊「下一步」。
三、接下來選擇掃描位置,通話記錄一般是存儲在手機機身內存中,在這里選擇手機。
四、待軟體成功掃描後,點擊左側的「通話記錄」,在右側中部勾選需恢復通話記錄的聯系人,點擊「恢復選中文件」,或直接點擊「恢復全部文件」。
然後就可以將安卓手機的通話記錄恢復了。雙屏可折疊手機雖然現在還未普及,但是隨著科技的進步,定能在不久後大放光彩。
3. 小米雙屏怎麼用
以小米cc9,Android 9系統為例。打開手機設置,點擊【更多設置】選項,再點擊【手勢及更多快捷】按鈕。然後找到【進入分屏】選項,接著選擇一個喜歡的快捷鍵設置,以【長按返回鍵】為例,當長按返回鍵屏幕出現雙屏時,就說明設置成功了。最後只需打開一個應用程序即可享受雙屏了。
小米手機怎麼雙屏
以小米cc9,Android 9系統為例。
1、打開手機找到設置菜單,進入設置界面。
2、找到更多設置,點擊進入更多設置。
3、進入更多設置界面,可以看到「手勢及更多快捷」按鈕。
4、點擊進入「手勢及更多快捷」,找到「進入分屏」。
5、進入分屏界面,選擇一個喜歡的快捷鍵按鈕點擊。
6、長按分屏,如果屏幕出現分屏則說明設置成功了。
7、最後選擇打開一個應用程序即可進入分屏模式。
上述就是關於小米手機怎麼雙屏的內容介紹了。
4. 微軟Surface Duo雙屏手機成功進入Win11 OOBE界面
近期,微軟才為Surface Duo初代帶來了安卓11大版本的更新升級,不過微軟的Surface Duo雙屏手機原本是要運行Windows 10X的,直到微軟放棄了這個項目,轉而使用安卓系統。
打開網易新聞 查看更多圖片
主要的LumiaWoA項目(可將Windows 10移植到微軟的Lumia 950XL手機上)黑客開發者Gustave Monce此前設法拿到了一台微軟Surface Duo安卓雙屏手機,研究Windows 11 ARM的移植工作。現在項目取得了新的進展,成功進入OOBE(開箱設置體驗)界面。此前,微軟Surface Duo成功啟動了Windows 11 ARM64系統。
這里的標志LOGO是由UEFI固件提供的,基本上只是兩個手機圖標粘在一起。
IT之家獲悉,微軟官方此前早已經對Windows 10 Mobile停止支持,不過在WoA項目開發者的努力下,仍然會有開發者去為Lumia舊機型和新安卓機型刷入新系統。
一、安裝Windows subsystem for Android
首先我們找到子系統的安裝包,有一些獲取方法,不過我這里直接提供安裝包的下載地址,大約為1.2G。
二、開啟Hyper-V功能
通常Windows默認是關閉Hyper-v功能的,所以你需要找到「開啟或者關閉Windows功能」,勾選Hyper-V,確定,然後重啟
三、安裝Android 應用
有兩種方法可以安裝Android應用
直接通過子系統自帶的亞馬遜應用商店下載,為什麼是它而不是Google Play Store,因為早前微軟和亞馬遜就達成了合作,Amazon作為其官方的應用商店,不過APP豐富程度就仁者見仁了。
5. 安卓雙屏異顯功能,是必須有一個HDMI嗎
這個需要外接一個橋,安卓手機一般是只有USB信號接入的,而HDMI是視頻信號,接入HDMI信號以後,需要到手機內安裝一個視頻預覽軟體,打開軟體就能看HDMI輸入的視頻信號,做其它功能需要軟體支持。看這樣是否滿足你的要求,OPR-XI100D就可以做橋接。
6. android 雙屏異顯,指定activity顯示在副屏
原來實現雙屏異顯完全是這東東起的作用.在此記錄一下學習的筆記,供後續參考... activity 的 context. 輔助顯示屏的內容:
7. 安卓手機分屏怎麼弄
以小米手機為例子。步驟方法如下:
1、首先將需要使用到的手機進行解鎖。