Launcher2分析(一)---整体结构和配置文件AndroidManifest.xml

从网上搜来的http://blog.chinaunix.net/u/24632/showart_2320672.html

好东西在这里完整的COPY下来留着现在看

今天开始launcher2分析系列,Launcher2的代码路径为: packages/apps/Launcher2

项目构成:
 
 
AndroidManifest.xml         项目Launcher2的描述文件
CleanSpec.mk                android项目授权文件?-->我的没有
NOTICE                      apache授权协议
Android.mk                  Launcher2编译的makefile
MODULE_LICENSE_APACHE2  空文件
proguard.flags          -keep clashh-->我的没有
res目录                 描述文件以及icon资源的位置
src目录                     源代码目录
 
先看AndroidManifest.xml文件,该文件是对Launcher2的配置文件

 

 

 

 

虽然还没有完全看完但是的确是好东西啊~~~

<?xml version="1.0" encoding="utf-8"?>
<!--
/*
**
** Copyright 2008, 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.
*/
-->
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"

package
="com.android.launcher"
android:sharedUserId
="@string/sharedUserId"
>
<!--package配置我们应用程序的包名 -->
<original-package android:name="com.android.launcher2"/>
<!--对系统资源访问的权限控制 -->
<permission
android:name="com.android.launcher.permission.INSTALL_SHORTCUT"
android:permissionGroup
="android.permission-group.SYSTEM_TOOLS"
android:protectionLevel
="normal"
android:label
="@string/permlab_install_shortcut"
android:description
="@string/permdesc_install_shortcut"/>
<permission
android:name="com.android.launcher.permission.UNINSTALL_SHORTCUT"
android:permissionGroup
="android.permission-group.SYSTEM_TOOLS"
android:protectionLevel
="normal"
android:label
="@string/permlab_uninstall_shortcut"
android:description
="@string/permdesc_uninstall_shortcut"/>
<permission
android:name="com.android.launcher.permission.READ_SETTINGS"
android:permissionGroup
="android.permission-group.SYSTEM_TOOLS"
android:protectionLevel
="normal"
android:label
="@string/permlab_read_settings"
android:description
="@string/permdesc_read_settings"/>
<permission
android:name="com.android.launcher.permission.WRITE_SETTINGS"
android:permissionGroup
="android.permission-group.SYSTEM_TOOLS"
android:protectionLevel
="normal"
android:label
="@string/permlab_write_settings"
android:description
="@string/permdesc_write_settings"/>

<uses-permission android:name="android.permission.CALL_PHONE"/>
<uses-permission android:name="android.permission.EXPAND_STATUS_BAR"/>
<uses-permission android:name="android.permission.GET_TASKS"/>
<uses-permission android:name="android.permission.READ_CONTACTS"/>
<uses-permission android:name="android.permission.SET_WALLPAPER"/>
<uses-permission android:name="android.permission.SET_WALLPAPER_HINTS"/>
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.WRITE_SETTINGS"/>
<uses-permission android:name="android.permission.BIND_APPWIDGET"/>
<uses-permission android:name="com.android.launcher.permission.READ_SETTINGS"/>
<uses-permission android:name="com.android.launcher.permission.WRITE_SETTINGS"/>
<!--对我们应用程序的配置 -->
<application
android:name="com.android.launcher2.LauncherApplication"
android:process
="@string/process"
android:label
="@string/application_name"
android:icon
="@drawable/ic_launcher_home">

<!--配置应用程序额的名字,进程,标签,和图标

label的值为values/strings.xml中application_name 键值对的值

icon为drawable目录下名为的ic_launcher_home的图片

实际上该图片的位置位于drawable-hdpi(高分辨率)目录下,是个小房子

这个主要是为了支持多分辨率的.
hdpi里面主要放高分辨率的图片,如WVGA (480x800),FWVGA (480x854)
mdpi里面主要放中等分辨率的图片,如HVGA (320x480)
ldpi里面主要放低分辨率的图片,如QVGA (240x320)
系统会根据机器的分辨率来分别到这几个文件夹里面去找对应的图片

所以在开发程序时为了兼容不同平台不同屏幕,建议各自文件夹根据需求均存放不同版本图片
但是有个问题还没有解决就是Android是如何判断我使用的是什么样的分辨率呢??
-->

<activity
android:name="com.android.launcher2.Launcher"
android:launchMode
="singleTask"
android:clearTaskOnLaunch
="true"
android:stateNotNeeded
="true"
android:theme
="@style/Theme"
android:screenOrientation
="nosensor"
android:windowSoftInputMode
="stateUnspecified|adjustPan">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.HOME"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.MONKEY"/>
</intent-filter>
</activity>
<!--
一个项目可能有很多activity,设置intent-filter可以先启动该activity
主要是有这个 <action android:name="android.intent.action.MAIN" />

-->
<activity
android:name="com.android.launcher2.WallpaperChooser"
android:label
="@string/pick_wallpaper"
android:icon
="@drawable/ic_launcher_wallpaper"
android:screenOrientation
="nosensor"
android:finishOnCloseSystemDialogs
="true">
<intent-filter>
<action android:name="android.intent.action.SET_WALLPAPER"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
<!--设置wallpapaer的activity -->
<!-- Intent received used to install shortcuts from other applications -->
<receiver
android:name="com.android.launcher2.InstallShortcutReceiver"
android:permission
="com.android.launcher.permission.INSTALL_SHORTCUT">
<intent-filter>
<action android:name="com.android.launcher.action.INSTALL_SHORTCUT"/>
</intent-filter>
</receiver>
<!--安装快捷方式的intent -->
<!-- Intent received used to uninstall shortcuts from other applications -->
<receiver
android:name="com.android.launcher2.UninstallShortcutReceiver"
android:permission
="com.android.launcher.permission.UNINSTALL_SHORTCUT">
<intent-filter>
<action android:name="com.android.launcher.action.UNINSTALL_SHORTCUT"/>
</intent-filter>
</receiver>
<!--设置删除快捷方式的intent -->
<!-- The settings provider contains Home -->

<!--
上面的是我COPY来的更改了很少的东西
但是这个XML并不完整有些东西的没有在下面加上
-->
<provider
android:name="LauncherProvider"
android:authorities
="com.android.launcher2.settings"
android:writePermission
="com.android.launcher.permission.WRITE_SETTINGS"
android:readPermission
="com.android.launcher.permission.READ_SETTINGS"/>
<!--
这些按着翻译是供应商给出的一些应用
-->


<!-- Enable system-default search mode for any activity in Home -->
<meta-data
android:name="android.app.default_searchable"
android:value
="*"/>

<!-- 上面这段是在墙纸的下面(XML中是没有顺序的限制的)
是默认的搜索栏--可能吧哈哈形似
-->

</application>
</manifest>


 

 

posted @ 2010-09-14 18:00  飞翔的熊猫  阅读(7061)  评论(0编辑  收藏  举报