Merge "Add textview and framelayout inflation cases, refactor." am: 1b3687c0e9 am: e11cfda38c
am: 197e665060
Change-Id: I64c6b815ad751741170d634fa51fa49aa84ae6f8
This commit is contained in:
@@ -18,6 +18,9 @@ android_app {
|
||||
name: "startop_test_app",
|
||||
srcs: [
|
||||
"src/EmptyActivity.java",
|
||||
"src/LayoutInflation.java",
|
||||
"src/LayoutInflationActivity.java",
|
||||
"src/ComplexLayoutInflationActivity.java",
|
||||
"src/FrameLayoutInflationActivity.java",
|
||||
"src/TextViewInflationActivity.java",
|
||||
],
|
||||
}
|
||||
|
||||
@@ -23,7 +23,12 @@
|
||||
android:label="@string/app_name"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true">
|
||||
<activity android:name=".EmptyActivity">
|
||||
|
||||
<activity
|
||||
android:label="Complex Layout Test"
|
||||
android:name=".ComplexLayoutInflationActivity"
|
||||
android:exported="true" >
|
||||
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
@@ -31,7 +36,41 @@
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<activity android:name=".LayoutInflation" android:exported="true" />
|
||||
<activity
|
||||
android:label="Empty Activity Layout Test"
|
||||
android:name=".EmptyActivity"
|
||||
android:exported="true" >
|
||||
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:label="FrameLayout Layout Test"
|
||||
android:name=".FrameLayoutInflationActivity"
|
||||
android:exported="true" >
|
||||
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:label="TextView Layout Test"
|
||||
android:name=".TextViewInflationActivity"
|
||||
android:exported="true" >
|
||||
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
|
||||
@@ -23,4 +23,4 @@ The activity adds an `inflate#activity_main` slice to atrace around the time
|
||||
spent in view inflation to make it easier to focus on the time spent in view
|
||||
inflation.
|
||||
|
||||
adb shell am start -n com.android.startop.test/.LayoutInflation
|
||||
adb shell am start -n com.android.startop.test/.ComplexLayoutInflationActivity
|
||||
|
||||
5013
startop/apps/test/res/layout/framelayout_list.xml
Normal file
5013
startop/apps/test/res/layout/framelayout_list.xml
Normal file
File diff suppressed because it is too large
Load Diff
5014
startop/apps/test/res/layout/textview_list.xml
Normal file
5014
startop/apps/test/res/layout/textview_list.xml
Normal file
File diff suppressed because it is too large
Load Diff
34
startop/apps/test/src/ComplexLayoutInflationActivity.java
Normal file
34
startop/apps/test/src/ComplexLayoutInflationActivity.java
Normal file
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright (C) 2019 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.startop.test;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
/**
|
||||
* This activity inflates a reasonably complex layout to see the impact of
|
||||
* layout inflation. The layout is supported by the viewcompiler, so this can be
|
||||
* used for testing precompiled layout performance.
|
||||
*/
|
||||
public class ComplexLayoutInflationActivity extends LayoutInflationActivity {
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
Bundle newState = savedInstanceState == null
|
||||
? new Bundle() : new Bundle(savedInstanceState);
|
||||
newState.putInt(LAYOUT_ID, R.layout.activity_main);
|
||||
|
||||
super.onCreate(newState);
|
||||
}
|
||||
}
|
||||
@@ -1,18 +1,18 @@
|
||||
//
|
||||
// Copyright (C) 2019 The Android Open Source Project
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
/*
|
||||
* Copyright (C) 2019 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.startop.test;
|
||||
|
||||
|
||||
29
startop/apps/test/src/FrameLayoutInflationActivity.java
Normal file
29
startop/apps/test/src/FrameLayoutInflationActivity.java
Normal file
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright (C) 2019 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.startop.test;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
public class FrameLayoutInflationActivity extends LayoutInflationActivity {
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
Bundle newState = savedInstanceState == null
|
||||
? new Bundle() : new Bundle(savedInstanceState);
|
||||
newState.putInt(LAYOUT_ID, R.layout.framelayout_list);
|
||||
|
||||
super.onCreate(newState);
|
||||
}
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
//
|
||||
// Copyright (C) 2019 The Android Open Source Project
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
package com.android.startop.test;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.os.Trace;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
||||
/**
|
||||
* This activity inflates a reasonably complex layout to see the impact of
|
||||
* layout inflation. The layout is supported by the viewcompiler, so this can be
|
||||
* used for testing precompiled layout performance.
|
||||
*/
|
||||
public class LayoutInflation extends Activity {
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
LayoutInflater inflater = LayoutInflater.from(this);
|
||||
Trace.beginSection("inflate layout:activity_main");
|
||||
View view = inflater.inflate(R.layout.activity_main, /*root=*/null);
|
||||
Trace.endSection();
|
||||
setContentView(view);
|
||||
}
|
||||
}
|
||||
39
startop/apps/test/src/LayoutInflationActivity.java
Normal file
39
startop/apps/test/src/LayoutInflationActivity.java
Normal file
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright (C) 2019 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.startop.test;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.os.Trace;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
||||
public class LayoutInflationActivity extends Activity {
|
||||
public static String LAYOUT_ID = "layout-id";
|
||||
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
int layoutId = savedInstanceState.getInt(LAYOUT_ID);
|
||||
String layoutName = getResources().getResourceEntryName(layoutId);
|
||||
|
||||
LayoutInflater inflater = LayoutInflater.from(this);
|
||||
Trace.beginSection("inflate layout: " + layoutName);
|
||||
View view = inflater.inflate(layoutId, /*root=*/null);
|
||||
Trace.endSection();
|
||||
setContentView(view);
|
||||
}
|
||||
}
|
||||
29
startop/apps/test/src/TextViewInflationActivity.java
Normal file
29
startop/apps/test/src/TextViewInflationActivity.java
Normal file
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright (C) 2019 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.startop.test;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
public class TextViewInflationActivity extends LayoutInflationActivity {
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
Bundle newState = savedInstanceState == null
|
||||
? new Bundle() : new Bundle(savedInstanceState);
|
||||
newState.putInt(LAYOUT_ID, R.layout.textview_list);
|
||||
|
||||
super.onCreate(newState);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user